Description
In 3.11 we are using now an opaque pointer to _PyInterpreterFrame
in the eval function. The problem is that for PEP 523's APIs, we changed the type of _PyFrameEvalFunction
to be PyObject *(*_PyFrameEvalFunction)(PyThreadState *tstate, _PyInterpreterFrame *frame, int throwflag)
but there is no way to do anything with _PyInterpreterFrame
because is opaque. Even if the extension defines PY_BUILD_CORE
the symbols are not exposed in the executable/libpython, which means that including the headers is insufficient.
This is a problem because it really limits what users of PEP 523 can do with the frame object that they receive, even if is opaque. Most profilers using PEP 523 API do it for speed reasons and the only thing they need is to get the line number, but that is now impossible because the pointer is opaque and we don't offer any exposed APIs.
Linked PRs
- GH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. #96849
- GH-96803: Document and test new unstable internal frame API functions #104211
- GH-96803: Move PyUnstable_InterpreterFrame_GetCode() to Python.h #107188
- [3.12] GH-96803: Move PyUnstable_InterpreterFrame_GetCode() to Python.h (GH-107188) #107195