Tony The Lion
Tony The Lion

Reputation: 63200

Handles and pointer to object

I have a python Interpreter written in C++, the PyRun_String function from the Python API is said to return a handle, however in my code I have it assigned to pointer to a PyObject?

PyObject* presult = PyRun_String(code, parse_mode, dict, dict); 

Is this actually correct? Can you implicitly cast this handle to this object pointer?

Should it not be a HANDLE instead?

Upvotes: 0

Views: 158

Answers (1)

moonshadow
moonshadow

Reputation: 89085

The word "handle" in API documentation usually does not refer specifically to the HANDLE type, but rather to any type intended to be opaque to the user.

PyRun_String in particular returns a PyObject*, there is no cast going on.

Upvotes: 1

Related Questions