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@gmail.com>

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Pablo Galindo 2021-07-05 12:10:53 +01:00 committed by GitHub
parent 09302405d2
commit b324c4c5f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View 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;