Skip to content

Commit

Permalink
bpo-40048: Fix _PyCode_InitOpcache() error path (pythonGH-19691)
Browse files Browse the repository at this point in the history
If _PyCode_InitOpcache() fails in _PyEval_EvalFrameDefault(), use
"goto exit_eval_frame;" rather than "return NULL;" to exit the
function in a consistent state. For example, tstate->frame is now
reset properly.
  • Loading branch information
vstinner authored Apr 24, 2020
1 parent 9f27dd3 commit 2510494
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, PyFrameObject *f, int throwflag)
co->co_opcache_flag++;
if (co->co_opcache_flag == OPCACHE_MIN_RUNS) {
if (_PyCode_InitOpcache(co) < 0) {
return NULL;
goto exit_eval_frame;
}
#if OPCACHE_STATS
opcache_code_objects_extra_mem +=
Expand Down

0 comments on commit 2510494

Please sign in to comment.