https://github.com/python/cpython/commit/7c1f0074a0eb8426c6d7668d217e8964d32f1b46 commit: 7c1f0074a0eb8426c6d7668d217e8964d32f1b46 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: JelleZijlstra <[email protected]> date: 2026-10-21T19:13:47Z summary:
[3.15] gh-159739: Collect grapheme iterator and segment type cycles (GH-159975) (#160013) (cherry picked from commit 990bcd9abdd1063dc90d8f182b6f85b1d8149bb8) Co-authored-by: Jelle Zijlstra <[email protected]> files: A Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.0c4ae9.rst M Modules/unicodedata.c diff --git a/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.0c4ae9.rst b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.0c4ae9.rst new file mode 100644 index 00000000000000..3392832f714adc --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-10-20-00-00-00.gh-issue-159739.0c4ae9.rst @@ -0,0 +1,2 @@ +Fix reference cycles involving the types of grapheme iterators and segments +created by :func:`unicodedata.iter_graphemes`. diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index b52801018b8846..6049ec3b56912f 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -2001,6 +2001,7 @@ Segment_dealloc(PyObject *self) static int Segment_traverse(PyObject *self, visitproc visit, void *arg) { + Py_VISIT(Py_TYPE(self)); Py_VISIT(((SegmentObject *)self)->string); return 0; } @@ -2069,6 +2070,7 @@ GBI_dealloc(PyObject *self) static int GBI_traverse(PyObject *self, visitproc visit, void *arg) { + Py_VISIT(Py_TYPE(self)); Py_VISIT(((GraphemeBreakIterator *)self)->iter.str); return 0; } _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
