[Python-checkins] [3.7] bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
Miss Islington (bot)
webhook-mailer at python.org
Fri May 8 07:30:35 EDT 2020
https://github.com/python/cpython/commit/25014289887cb521c1041df4773c839d3fbf784e
commit: 25014289887cb521c1041df4773c839d3fbf784e
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-08T04:30:30-07:00
summary:
[3.7] bpo-40559: Add Py_DECREF to _asynciomodule.c:task_step_impl() (GH-19990)
This fixes a possible memory leak in the C implementation of
asyncio.Task.
(cherry picked from commit d2c349b190bcba21a4a38e6520a48ad97a9f1529)
Co-authored-by: Chris Jerdonek <chris.jerdonek at gmail.com>
files:
A Misc/NEWS.d/next/Library/2020-05-05-08-12-51.bpo-40559.112wwa.rst
M Modules/_asynciomodule.c
diff --git a/Misc/NEWS.d/next/Library/2020-05-05-08-12-51.bpo-40559.112wwa.rst b/Misc/NEWS.d/next/Library/2020-05-05-08-12-51.bpo-40559.112wwa.rst
new file mode 100644
index 0000000000000..15846351f25bb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-05-05-08-12-51.bpo-40559.112wwa.rst
@@ -0,0 +1 @@
+Fix possible memory leak in the C implementation of :class:`asyncio.Task`.
\ No newline at end of file
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 441506bc82a14..7880de327f637 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -2567,6 +2567,10 @@ task_step_impl(TaskObj *task, PyObject *exc)
coro = task->task_coro;
if (coro == NULL) {
PyErr_SetString(PyExc_RuntimeError, "uninitialized Task object");
+ if (clear_exc) {
+ /* We created 'exc' during this call */
+ Py_DECREF(exc);
+ }
return NULL;
}
More information about the Python-checkins
mailing list