aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-24 02:43:18 +0200
committerGitHub <noreply@github.com>2020-04-24 02:43:18 +0200
commit25104949a5a60ff86c10691e184ce2ecb500159b (patch)
treefb8ff45bfbe89166981741f469903041f53c0a91 /Python/ceval.c
parentUse Py_ssize_t instead of ssize_t (GH-19685) (diff)
downloadcpython-25104949a5a60ff86c10691e184ce2ecb500159b.tar.gz
cpython-25104949a5a60ff86c10691e184ce2ecb500159b.tar.bz2
cpython-25104949a5a60ff86c10691e184ce2ecb500159b.zip
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.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 59765d850ba..c610419f24f 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 +=