Skip to content

Commit 305182f

Browse files
committed
gh-159739: Collect grapheme iterator and segment type cycles
Backport to 3.15.
1 parent 80040b6 commit 305182f

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix reference cycles involving the types of grapheme iterators and segments
2+
created by :func:`unicodedata.iter_graphemes`.

‎Modules/unicodedata.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,6 +1989,7 @@ Segment_dealloc(PyObject *self)
19891989
static int
19901990
Segment_traverse(PyObject *self, visitproc visit, void *arg)
19911991
{
1992+
Py_VISIT(Py_TYPE(self));
19921993
Py_VISIT(((SegmentObject *)self)->string);
19931994
return 0;
19941995
}
@@ -2057,6 +2058,7 @@ GBI_dealloc(PyObject *self)
20572058
static int
20582059
GBI_traverse(PyObject *self, visitproc visit, void *arg)
20592060
{
2061+
Py_VISIT(Py_TYPE(self));
20602062
Py_VISIT(((GraphemeBreakIterator *)self)->iter.str);
20612063
return 0;
20622064
}

0 commit comments

Comments
 (0)