Skip to content

Commit 7c1f007

Browse files
[3.15] gh-159739: Collect grapheme iterator and segment type cycles (GH-159975) (#160013)
(cherry picked from commit 990bcd9) Co-authored-by: Jelle Zijlstra <jelle@openai.com>
1 parent 2c17c77 commit 7c1f007

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
@@ -2001,6 +2001,7 @@ Segment_dealloc(PyObject *self)
20012001
static int
20022002
Segment_traverse(PyObject *self, visitproc visit, void *arg)
20032003
{
2004+
Py_VISIT(Py_TYPE(self));
20042005
Py_VISIT(((SegmentObject *)self)->string);
20052006
return 0;
20062007
}
@@ -2069,6 +2070,7 @@ GBI_dealloc(PyObject *self)
20692070
static int
20702071
GBI_traverse(PyObject *self, visitproc visit, void *arg)
20712072
{
2073+
Py_VISIT(Py_TYPE(self));
20722074
Py_VISIT(((GraphemeBreakIterator *)self)->iter.str);
20732075
return 0;
20742076
}

0 commit comments

Comments
 (0)