summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-24 01:07:20 (GMT)
committerGitHub <noreply@github.com>2020-04-24 01:07:20 (GMT)
commitd9df63deab78f70061a5a24c1f92e6d389fc45f7 (patch)
tree23165c6b9065fe792c323dadacd07b126372fb25 /Python
parent3340b2a61b458e7087c8c5fea063b1b45e1a4a07 (diff)
downloadcpython-d9df63deab78f70061a5a24c1f92e6d389fc45f7.zip
cpython-d9df63deab78f70061a5a24c1f92e6d389fc45f7.tar.gz
cpython-d9df63deab78f70061a5a24c1f92e6d389fc45f7.tar.bz2
bpo-40048: Fix _PyCode_InitOpcache() error path (GH-19691) (GH-19698)
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. (cherry picked from commit 25104949a5a60ff86c10691e184ce2ecb500159b)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 2db6e6b..1873e37 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1159,7 +1159,7 @@ _PyEval_EvalFrameDefault(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 +=