summaryrefslogtreecommitdiffstats
path: root/Objects/genericaliasobject.c
diff options
context:
space:
mode:
authorKen Jin <28750310+Fidget-Spinner@users.noreply.github.com>2021-07-04 16:47:38 (GMT)
committerGitHub <noreply@github.com>2021-07-04 16:47:38 (GMT)
commitd33943a6c368c2184e238019c63ac7a267da5594 (patch)
treed63c029e730decab7e2bd4c205db917f2aa68c39 /Objects/genericaliasobject.c
parentbc3961485639cc73de7c4c7eed1b56f3c74939bf (diff)
downloadcpython-d33943a6c368c2184e238019c63ac7a267da5594.zip
cpython-d33943a6c368c2184e238019c63ac7a267da5594.tar.gz
cpython-d33943a6c368c2184e238019c63ac7a267da5594.tar.bz2
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016)
Diffstat (limited to 'Objects/genericaliasobject.c')
-rw-r--r--Objects/genericaliasobject.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c
index 756a7ce..48a8be1 100644
--- a/Objects/genericaliasobject.c
+++ b/Objects/genericaliasobject.c
@@ -603,7 +603,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;
@@ -650,10 +650,10 @@ Py_GenericAlias(PyObject *origin, PyObject *args)
if (alias == NULL) {
return NULL;
}
+ _PyObject_GC_TRACK(alias);
if (!setup_ga(alias, origin, args)) {
- PyObject_GC_Del((PyObject *)alias);
+ Py_DECREF(alias);
return NULL;
}
- _PyObject_GC_TRACK(alias);
return (PyObject *)alias;
}