[Python-checkins] bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias (GH-27021)

pablogsal webhook-mailer at python.org
Mon Jul 5 07:10:58 EDT 2021


https://github.com/python/cpython/commit/b324c4c5f763c5116a97db8591e6dcb94456570a
commit: b324c4c5f763c5116a97db8591e6dcb94456570a
branch: main
author: Pablo Galindo <Pablogsal at gmail.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-07-05T12:10:53+01:00
summary:

bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias (GH-27021)

* bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias

* Update Objects/genericaliasobject.c

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
M Objects/genericaliasobject.c

diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 48a8be1c45875..803912b7a18a4 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -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;



More information about the Python-checkins mailing list