Hi,
I added PyThreadState_GetFrame() and PyFrame_GetCode() functions to Python 3.9 (as part of my work to make structures opaque). These functions are basically getter to access PyThreadState.frame and PyFrameObject.f_code members.
Example:
struct _frame* PyThreadState_GetFrame(PyThreadState *tstate) { assert(tstate != NULL); return tstate->frame; }
These functions currently return *borrowed* references.
I understood that borrowed references makes it harder to write an efficient implementation of Python: https://github.com/vstinner/misc/blob/master/cpython/pep-opaque-c-api.rst#bo...
For example, PyPy has to convert all items of a list to PyObject when a C extension module calls PyList_GetItem().
Question: should I modify PyThreadState_GetFrame() and PyFrame_GetCode() functions to return a *strong* reference instead?
Victor
Night gathers, and now my watch begins. It shall not end until my death.