[Python-checkins] bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691)
Victor Stinner
webhook-mailer at python.org
Thu Apr 23 20:43:23 EDT 2020
https://github.com/python/cpython/commit/25104949a5a60ff86c10691e184ce2ecb500159b
commit: 25104949a5a60ff86c10691e184ce2ecb500159b
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-24T02:43:18+02:00
summary:
bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691)
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.
files:
M Python/ceval.c
diff --git a/Python/ceval.c b/Python/ceval.c
index 59765d850ba1d..c610419f24f58 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -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 +=
More information about the Python-checkins
mailing list