mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27018)
(cherry picked from commit d33943a6c3)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
This commit is contained in:
parent
21be6cb030
commit
4684a34c8d
2 changed files with 5 additions and 3 deletions
|
|
@ -0,0 +1,2 @@
|
|||
Remove uses of :c:func:`PyObject_GC_Del` in error path when initializing
|
||||
:class:`types.GenericAlias`.
|
||||
|
|
@ -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;
|
||||
|
|
@ -644,10 +644,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue