[Python-checkins] bpo-44553: Correct failure in tp_new for the union object (GH-27008) (GH-27009)

pablogsal webhook-mailer at python.org
Sat Jul 3 16:51:18 EDT 2021


https://github.com/python/cpython/commit/000b9e803a7ec067da0a43f9a3fec16f1078215a
commit: 000b9e803a7ec067da0a43f9a3fec16f1078215a
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-07-03T21:51:10+01:00
summary:

bpo-44553: Correct failure in tp_new for the union object (GH-27008) (GH-27009)

(cherry picked from commit bc3961485639cc73de7c4c7eed1b56f3c74939bf)

Co-authored-by: Pablo Galindo <Pablogsal at gmail.com>

Co-authored-by: Pablo Galindo <Pablogsal at gmail.com>

files:
M Objects/unionobject.c

diff --git a/Objects/unionobject.c b/Objects/unionobject.c
index cc7181d2475ca..8435763b5ea7c 100644
--- a/Objects/unionobject.c
+++ b/Objects/unionobject.c
@@ -490,10 +490,10 @@ _Py_Union(PyObject *args)
     }
 
     result->args = dedup_and_flatten_args(args);
+    _PyObject_GC_TRACK(result);
     if (result->args == NULL) {
-        PyObject_GC_Del(result);
+        Py_DECREF(result);
         return NULL;
     }
-    _PyObject_GC_TRACK(result);
     return (PyObject*)result;
 }



More information about the Python-checkins mailing list