aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Objects/enumobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/enumobject.c')
-rw-r--r--Objects/enumobject.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/enumobject.c b/Objects/enumobject.c
index f5d9d41262a..1123b140c7f 100644
--- a/Objects/enumobject.c
+++ b/Objects/enumobject.c
@@ -6,6 +6,7 @@
#include "pycore_modsupport.h" // _PyArg_NoKwnames()
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString
+#include "pycore_tuple.h" // _PyTuple_Recycle()
#include "clinic/enumobject.c.h"
@@ -220,9 +221,7 @@ enum_next_long(enumobject *en, PyObject* next_item)
Py_DECREF(old_item);
// bpo-42536: The GC may have untracked this result tuple. Since we're
// recycling it, make sure it's tracked again:
- if (!_PyObject_GC_IS_TRACKED(result)) {
- _PyObject_GC_TRACK(result);
- }
+ _PyTuple_Recycle(result);
return result;
}
result = PyTuple_New(2);
@@ -272,9 +271,7 @@ enum_next(PyObject *op)
Py_DECREF(old_item);
// bpo-42536: The GC may have untracked this result tuple. Since we're
// recycling it, make sure it's tracked again:
- if (!_PyObject_GC_IS_TRACKED(result)) {
- _PyObject_GC_TRACK(result);
- }
+ _PyTuple_Recycle(result);
return result;
}
result = PyTuple_New(2);