Name

PyEval_EvalCode

Synopsis

PyObject* PyEval_EvalCode(PyObject* co,PyObject* globals,
PyObject* locals)

co is a Python code object, as returned by Py_CompileString, for example. globals and locals are dictionaries (may be the same dictionary twice) to use as global and local namespace for the execution. Returns the result of the expression when co was compiled with Py_eval_input, a new reference to Py_None otherwise, or NULL to indicate the execution has raised an exception.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.