diff options
Diffstat (limited to 'Modules/_functoolsmodule.c')
-rw-r--r-- | Modules/_functoolsmodule.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c index a101363..148d051 100644 --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -3,6 +3,7 @@ #include "pycore_pystate.h" #include "pycore_tupleobject.h" #include "structmember.h" +#include "pycore_object.h" // _PyObject_GC_TRACK /* _functools module written and maintained by Hye-Shik Chang <perky@FreeBSD.org> @@ -633,6 +634,11 @@ functools_reduce(PyObject *self, PyObject *args) if ((result = PyObject_Call(func, args, NULL)) == NULL) { goto Fail; } + // bpo-42536: The GC may have untracked this args tuple. Since we're + // recycling it, make sure it's tracked again: + if (!_PyObject_GC_IS_TRACKED(args)) { + _PyObject_GC_TRACK(args); + } } } |