mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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
This commit is contained in:
parent
84d3e764d7
commit
baaadbf70d
2 changed files with 120 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue