开发者

Handles and pointer to object

开发者 https://www.devze.com 2023-01-03 18:26 出处:网络
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?

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 n开发者_StackOverflow中文版ot be a HANDLE instead?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消