[Python-checkins] bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)

pablogsal webhook-mailer at python.org
Tue Mar 23 20:30:12 EDT 2021


https://github.com/python/cpython/commit/919d42d477093154a30b55d9d79f023dbbe5614a
commit: 919d42d477093154a30b55d9d79f023dbbe5614a
branch: master
author: Pablo Galindo <Pablogsal at gmail.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-03-24T00:30:02Z
summary:

bpo-31861: Fix possible crash in PyAnextAwaitable_New (GH-25005)

files:
M Objects/iterobject.c

diff --git a/Objects/iterobject.c b/Objects/iterobject.c
index 06a6da5695f8a..f0c6b79917680 100644
--- a/Objects/iterobject.c
+++ b/Objects/iterobject.c
@@ -368,7 +368,11 @@ PyTypeObject PyAnextAwaitable_Type = {
 PyObject *
 PyAnextAwaitable_New(PyObject *awaitable, PyObject *default_value)
 {
-    anextawaitableobject *anext = PyObject_GC_New(anextawaitableobject, &PyAnextAwaitable_Type);
+    anextawaitableobject *anext = PyObject_GC_New(
+            anextawaitableobject, &PyAnextAwaitable_Type);
+    if (anext == NULL) {
+        return NULL;
+    }
     Py_INCREF(awaitable);
     anext->wrapped = awaitable;
     Py_INCREF(default_value);



More information about the Python-checkins mailing list