summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2015-05-13 05:54:02 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2015-05-13 05:54:02 (GMT)
commitbaaadbf70d024142ec6a519006e960ec74309f92 (patch)
tree14d1110d7379aa17d17e7c1311a2bceb0324bcbe /Python
parent84d3e764d717a5c31af1a282463425a24f83f1de (diff)
downloadcpython-baaadbf70d024142ec6a519006e960ec74309f92.zip
cpython-baaadbf70d024142ec6a519006e960ec74309f92.tar.gz
cpython-baaadbf70d024142ec6a519006e960ec74309f92.tar.bz2
Issue 24017: fix for "async with" refcounting
* adds missing INCREF in WITH_CLEANUP_START * adds missing DECREF in WITH_CLEANUP_FINISH * adds several new tests Yury created while investigating this
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 77085c2..afb0f89 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3156,6 +3156,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if (res == NULL)
goto error;
+ Py_INCREF(exc); /* Duplicating the exception on the stack */
PUSH(exc);
PUSH(res);
PREDICT(WITH_CLEANUP_FINISH);
@@ -3174,6 +3175,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
err = 0;
Py_DECREF(res);
+ Py_DECREF(exc);
if (err < 0)
goto error;