diff options
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index e42d5f2..3767f55 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -4,6 +4,7 @@ #include <ctype.h> #include "ast.h" #undef Yield /* undefine macro conflicting with <winbase.h> */ +#include "pycore_object.h" // _PyObject_GC_TRACK() #include "pycore_pystate.h" #include "pycore_tupleobject.h" @@ -2618,6 +2619,11 @@ zip_next(zipobject *lz) PyTuple_SET_ITEM(result, i, item); Py_DECREF(olditem); } + // 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); + } } else { result = PyTuple_New(tuplesize); if (result == NULL) |