]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Revert "bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAli...
authorPablo Galindo <Pablogsal@gmail.com>
Sun, 4 Jul 2021 19:26:34 +0000 (20:26 +0100)
committerGitHub <noreply@github.com>
Sun, 4 Jul 2021 19:26:34 +0000 (20:26 +0100)
This reverts commit 4684a34c8d2a2ffac7b779edb4ba57f043783478.

Misc/NEWS.d/next/Core and Builtins/2021-07-04-23-38-51.bpo-44562.QdeRQo.rst [deleted file]
Objects/genericaliasobject.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2021-07-04-23-38-51.bpo-44562.QdeRQo.rst b/Misc/NEWS.d/next/Core and Builtins/2021-07-04-23-38-51.bpo-44562.QdeRQo.rst
deleted file mode 100644 (file)
index 2fc65bc..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Remove uses of :c:func:`PyObject_GC_Del` in error path when initializing
-:class:`types.GenericAlias`.
index bb5fa095d35739fa2703edf4587a3b60c9cfa4f8..945d20593c7c90116af51b78d9854c16e4156a00 100644 (file)
@@ -602,7 +602,7 @@ ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
         return NULL;
     }
     if (!setup_ga(self, origin, arguments)) {
-        Py_DECREF(self);
+        type->tp_free((PyObject *)self);
         return NULL;
     }
     return (PyObject *)self;
@@ -644,10 +644,10 @@ Py_GenericAlias(PyObject *origin, PyObject *args)
     if (alias == NULL) {
         return NULL;
     }
-    _PyObject_GC_TRACK(alias);
     if (!setup_ga(alias, origin, args)) {
-        Py_DECREF(alias);
+        PyObject_GC_Del((PyObject *)alias);
         return NULL;
     }
+    _PyObject_GC_TRACK(alias);
     return (PyObject *)alias;
 }