diff options
author | Mark Shannon <mark@hotpy.org> | 2021-10-11 10:34:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 10:34:02 (GMT) |
commit | fcb3d2ff633f3e9a826888d8b29c305a3959ff54 (patch) | |
tree | 5d9367bbe6e235521f32c5163df69404cc840a51 /Python/pystate.c | |
parent | 9883ca498d654a4792d530bd8d6d64fef4dc971c (diff) | |
download | cpython-fcb3d2ff633f3e9a826888d8b29c305a3959ff54.zip cpython-fcb3d2ff633f3e9a826888d8b29c305a3959ff54.tar.gz cpython-fcb3d2ff633f3e9a826888d8b29c305a3959ff54.tar.bz2 |
Restore PEP 523 functionality. (GH-28871)
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index 4527214..f02de92 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -230,7 +230,7 @@ PyInterpreterState_New(void) PyConfig_InitPythonConfig(&interp->config); _PyType_InitCache(interp); - interp->eval_frame = _PyEval_EvalFrameDefault; + interp->eval_frame = NULL; #ifdef HAVE_DLOPEN #if HAVE_DECL_RTLD_NOW interp->dlopenflags = RTLD_NOW; @@ -1973,6 +1973,9 @@ _register_builtins_for_crossinterpreter_data(struct _xidregistry *xidregistry) _PyFrameEvalFunction _PyInterpreterState_GetEvalFrameFunc(PyInterpreterState *interp) { + if (interp->eval_frame == NULL) { + return _PyEval_EvalFrameDefault; + } return interp->eval_frame; } @@ -1981,7 +1984,12 @@ void _PyInterpreterState_SetEvalFrameFunc(PyInterpreterState *interp, _PyFrameEvalFunction eval_frame) { - interp->eval_frame = eval_frame; + if (eval_frame == _PyEval_EvalFrameDefault) { + interp->eval_frame = NULL; + } + else { + interp->eval_frame = eval_frame; + } } |