diff --git a/Misc/NEWS.d/next/Library/2026-10-19-20-38-17.gh-issue-159739.bc65da.rst b/Misc/NEWS.d/next/Library/2026-10-19-20-38-17.gh-issue-159739.bc65da.rst new file mode 100644 index 00000000000000..fd831b6907e777 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-10-19-20-38-17.gh-issue-159739.bc65da.rst @@ -0,0 +1,2 @@ +Allow cyclic garbage collection to reclaim group records returned by +:mod:`grp`. diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c index fe1d16d8322005..5404250ee7387f 100644 --- a/Modules/grpmodule.c +++ b/Modules/grpmodule.c @@ -111,6 +111,7 @@ mkgrent(PyObject *module, struct group *p) return NULL; } + PyObject_GC_Track(v); return v; }