]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias (GH-27021)
authorPablo Galindo <Pablogsal@gmail.com>
Mon, 5 Jul 2021 11:10:53 +0000 (12:10 +0100)
committerGitHub <noreply@github.com>
Mon, 5 Jul 2021 11:10:53 +0000 (12:10 +0100)
* bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias

* Update Objects/genericaliasobject.c

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Objects/genericaliasobject.c

index 48a8be1c458752a4a4637f2ec0bd4c87a13f781f..803912b7a18a49e52cf1d69e6a056175255139dd 100644 (file)
@@ -646,11 +646,11 @@ PyTypeObject Py_GenericAliasType = {
 PyObject *
 Py_GenericAlias(PyObject *origin, PyObject *args)
 {
-    gaobject *alias = PyObject_GC_New(gaobject, &Py_GenericAliasType);
+    gaobject *alias = (gaobject*) PyType_GenericAlloc(
+            (PyTypeObject *)&Py_GenericAliasType, 0);
     if (alias == NULL) {
         return NULL;
     }
-    _PyObject_GC_TRACK(alias);
     if (!setup_ga(alias, origin, args)) {
         Py_DECREF(alias);
         return NULL;