Maybe I'm missing something, but here is a problem:
I'm tracing python code by C extensions and my trace function got PyFrameObject* frame. Now I want to process the frame by Python code(embedded or converted to C by Cython) but it deals with PyObject*.
How do I convert PyFrameObject* to PyObject*? I don't find appropriate convertion funciton in frameobject.h.
Thanks.
Use a cast:
PyObject *myObject = (PyObject *)myFrameObject
This is standard for the Python C API; everything that "inherits" from PyObject
has a PyObject_VAR_HEAD
at the top of the object so a pointer to the object is convertible to a pointer to PyObject
.