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:
Nick Coghlan 2015-05-13 15:54:02 +10:00
parent 84d3e764d7
commit baaadbf70d
2 changed files with 120 additions and 2 deletions

View file

@ -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;