diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-12-08-03-40-43.bpo-18372.DT1nR0.rst b/Misc/NEWS.d/next/Core and Builtins/2018-12-08-03-40-43.bpo-18372.DT1nR0.rst new file mode 100644 index 000000000000000..d8205b8d32d0e41 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-12-08-03-40-43.bpo-18372.DT1nR0.rst @@ -0,0 +1,2 @@ +Add missing :c:func:`PyObject_GC_Track` calls in the :mod:`pickle` module. +Patch by Zackery Spytz. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 294f33419cb5b17..191661118852f55 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -1117,6 +1117,8 @@ _Pickler_New(void) Py_DECREF(self); return NULL; } + + PyObject_GC_Track(self); return self; } @@ -1492,6 +1494,7 @@ _Unpickler_New(void) return NULL; } + PyObject_GC_Track(self); return self; }