A question about Python's API

Gary Herron gherron at islandtraining.com
Sat Mar 13 18:53:27 CET 2004


Hello python-list,

A student trying to embed Python into a game engine seems to have
uncovered the following oversight of Python's API,

There is a function named Py_CompileString which produces a code
object from a string, but we can't find a a function in the published
API to execute that code object.

There is a function named PyEval_EvalCode which looks like the right
thing to use, but it's not part of the published API, and it's
definition is not included when one #include's Python.h.
Nevertheless, I've suggested that he #include eval.h and try calling
the function to see if it is what he wants.

So ...  Is this our oversight, and there really is something in the
API to execute the code object returned by Py_CompileString, or should
the API be enhanced to include PyEval_EvalCode or something similar?

Thanks,

Gary Herron









More information about the Python-list mailing list