From 014f3b971c5fb3daf2cbc967b79f1f714580f953 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 28 Jan 2022 13:47:24 +0100 Subject: [PATCH] bpo-46417: _PyStructSequence_FiniType() updates _Py_RefTotal --- Objects/structseq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Objects/structseq.c b/Objects/structseq.c index cded877300d9e9..092e1634656a31 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -553,6 +553,9 @@ _PyStructSequence_FiniType(PyTypeObject *type) // Undo Py_INCREF(type) of _PyStructSequence_InitType(). // Don't use Py_DECREF(): static type must not be deallocated Py_SET_REFCNT(type, 0); +#ifdef Py_REF_DEBUG + _Py_RefTotal--; +#endif // Make sure that _PyStructSequence_InitType() will initialize // the type again