Skip to content

Commit fe847a6

Browse files
authored
Revert "bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27018)" (GH-27022)
This reverts commit 4684a34.
1 parent 4684a34 commit fe847a6

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Misc/NEWS.d/next/Core and Builtins/2021-07-04-23-38-51.bpo-44562.QdeRQo.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.

Objects/genericaliasobject.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ ga_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
602602
return NULL;
603603
}
604604
if (!setup_ga(self, origin, arguments)) {
605-
Py_DECREF(self);
605+
type->tp_free((PyObject *)self);
606606
return NULL;
607607
}
608608
return (PyObject *)self;
@@ -644,10 +644,10 @@ Py_GenericAlias(PyObject *origin, PyObject *args)
644644
if (alias == NULL) {
645645
return NULL;
646646
}
647-
_PyObject_GC_TRACK(alias);
648647
if (!setup_ga(alias, origin, args)) {
649-
Py_DECREF(alias);
648+
PyObject_GC_Del((PyObject *)alias);
650649
return NULL;
651650
}
651+
_PyObject_GC_TRACK(alias);
652652
return (PyObject *)alias;
653653
}

0 commit comments

Comments
 (0)