Commit 692796a9 authored by Yury Selivanov's avatar Yury Selivanov

Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw.

parent c3d7dbb8
...@@ -38,6 +38,8 @@ Library ...@@ -38,6 +38,8 @@ Library
- Issue #28634: Fix asyncio.isfuture() to support unittest.Mock. - Issue #28634: Fix asyncio.isfuture() to support unittest.Mock.
- Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw.
Documentation Documentation
------------- -------------
......
...@@ -1044,15 +1044,17 @@ FutureIter_throw(futureiterobject *self, PyObject *args) ...@@ -1044,15 +1044,17 @@ FutureIter_throw(futureiterobject *self, PyObject *args)
else { else {
if (PyExceptionClass_Check(type)) { if (PyExceptionClass_Check(type)) {
val = PyObject_CallObject(type, NULL); val = PyObject_CallObject(type, NULL);
PyErr_SetObject(type, val);
Py_DECREF(val);
} }
else { else {
val = type; val = type;
assert (PyExceptionInstance_Check(val)); assert (PyExceptionInstance_Check(val));
type = (PyObject*)Py_TYPE(val); type = (PyObject*)Py_TYPE(val);
assert (PyExceptionClass_Check(type)); assert (PyExceptionClass_Check(type));
}
PyErr_SetObject(type, val); PyErr_SetObject(type, val);
} }
}
return FutureIter_iternext(self); return FutureIter_iternext(self);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment