summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>2021-07-06 00:22:43 +0800
committerGitHub <noreply@github.com>2021-07-05 17:22:43 +0100
commit51a29c42f10bd9368db9a21f2f63319be2e30b95 (patch)
treeab58efea90bb969a878321bc245497e3f61e7d5a /Objects
parent9f47d872dbebdd95fd6b0a3351aeafaf82dfd203 (diff)
downloadcpython-git-51a29c42f10bd9368db9a21f2f63319be2e30b95.tar.gz
[3.9] bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27028)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/genericaliasobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 945d20593c..69ad8a6d83 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -602,7 +602,7 @@ ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return NULL;
}
if (!setup_ga(self, origin, arguments)) {
- type->tp_free((PyObject *)self);
+ Py_DECREF(self);
return NULL;
}
return (PyObject *)self;
@@ -640,14 +640,14 @@ 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;
}
if (!setup_ga(alias, origin, args)) {
- PyObject_GC_Del((PyObject *)alias);
+ Py_DECREF(alias);
return NULL;
}
- _PyObject_GC_TRACK(alias);
return (PyObject *)alias;
}