Esempio n. 1
0
File: code.go Progetto: MogeiWang/py
func (code *Code) Run(globals, locals *Base) error {
	pyCode := (*C.PyCodeObject)(unsafe.Pointer(code))
	ret := C.PyEval_EvalCode(pyCode, globals.c(), locals.c())
	if ret == nil {
		return exception()
	}
	C.decref(ret)
	return nil
}
Esempio n. 2
0
File: code.go Progetto: MogeiWang/py
// Return value: New reference.
func (code *Code) Eval(globals, locals *Base) (*Base, error) {
	pyCode := (*C.PyCodeObject)(unsafe.Pointer(code))
	ret := C.PyEval_EvalCode(pyCode, globals.c(), locals.c())
	return obj2ObjErr(ret)
}
Esempio n. 3
0
func (code *Code) Eval(globals, locals Object) (Object, error) {
	pyCode := (*C.PyObject)(unsafe.Pointer(code))
	ret := C.PyEval_EvalCode(pyCode, c(globals), c(locals))
	return obj2ObjErr(ret)
}