From: Yury Selivanov Date: Wed, 9 Nov 2016 00:04:57 +0000 (-0500) Subject: Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. X-Git-Tag: v3.6.0b4~122 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=692796a948ab67d75f7010e96b31885eefbd88e5;p=thirdparty%2FPython%2Fcpython.git Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. --- diff --git a/Misc/NEWS b/Misc/NEWS index fee8579a94fc..ffbdb8918f36 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,8 @@ Library - Issue #28634: Fix asyncio.isfuture() to support unittest.Mock. +- Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. + Documentation ------------- diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c index 7df6fa5008b0..df81b105ec50 100644 --- a/Modules/_asynciomodule.c +++ b/Modules/_asynciomodule.c @@ -1044,14 +1044,16 @@ FutureIter_throw(futureiterobject *self, PyObject *args) else { if (PyExceptionClass_Check(type)) { val = PyObject_CallObject(type, NULL); + PyErr_SetObject(type, val); + Py_DECREF(val); } else { val = type; assert (PyExceptionInstance_Check(val)); type = (PyObject*)Py_TYPE(val); assert (PyExceptionClass_Check(type)); + PyErr_SetObject(type, val); } - PyErr_SetObject(type, val); } return FutureIter_iternext(self); }