summaryrefslogtreecommitdiffstats
path: root/Modules/_asynciomodule.c
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2016-11-09 00:04:57 (GMT)
committerYury Selivanov <yury@magic.io>2016-11-09 00:04:57 (GMT)
commit692796a948ab67d75f7010e96b31885eefbd88e5 (patch)
treebf583292027adc5ce87654556095af0326aef95b /Modules/_asynciomodule.c
parentc3d7dbb82122b7bd14da9493d82f6675510f206a (diff)
downloadcpython-692796a948ab67d75f7010e96b31885eefbd88e5.zip
cpython-692796a948ab67d75f7010e96b31885eefbd88e5.tar.gz
cpython-692796a948ab67d75f7010e96b31885eefbd88e5.tar.bz2
Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw.
Diffstat (limited to 'Modules/_asynciomodule.c')
-rw-r--r--Modules/_asynciomodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 7df6fa5..df81b10 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);
}