diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-04 17:55:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 17:55:43 (GMT) |
commit | 4684a34c8d2a2ffac7b779edb4ba57f043783478 (patch) | |
tree | 5d51f22fd803d99b225fb65001b226724fbfe5bc /Objects | |
parent | 21be6cb0304ba143980b7e4c875cb5b9db30952b (diff) | |
download | cpython-4684a34c8d2a2ffac7b779edb4ba57f043783478.zip cpython-4684a34c8d2a2ffac7b779edb4ba57f043783478.tar.gz cpython-4684a34c8d2a2ffac7b779edb4ba57f043783478.tar.bz2 |
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) (GH-27018)
(cherry picked from commit d33943a6c368c2184e238019c63ac7a267da5594)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/genericaliasobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/genericaliasobject.c b/Objects/genericaliasobject.c index 945d205..bb5fa09 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; @@ -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; } |