Beispiel #1
0
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
}
Beispiel #2
0
// 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)
}
Beispiel #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)
}