[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

STINNER Victor report at bugs.python.org
Fri Nov 22 08:12:21 EST 2019


STINNER Victor <vstinner at python.org> added the comment:

I wrote PR 17340 to add Add PyInterpreterState_GetEvalFrameFunc() and PyInterpreterState_SetEvalFrameFunc() functions.

Since the PEP 523 has been approved, for me, these functions must be public, not private. My implementation adds these functions to Include/cpython/pystate.h: "non-portable" API specific to CPython (exclude from the limited C API).

PyInterpreterState_GetEvalFrameFunc() is needed if you want to inject a "hook" and not really replaced the whole function. For example, execute code before or after the call. I guess that PyCharm debugger works like that.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38500>
_______________________________________


More information about the Python-bugs-list mailing list