Skip to content

Commit 85013d7

Browse files
Fix refleaks in new unicodedata classes added in gh-74902 (GH-143843)
1 parent 14f96a8 commit 85013d7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Modules/unicodedata.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,9 +1885,11 @@ typedef struct {
18851885
static void
18861886
Segment_dealloc(PyObject *self)
18871887
{
1888+
PyTypeObject *tp = Py_TYPE(self);
18881889
PyObject_GC_UnTrack(self);
18891890
Py_DECREF(((SegmentObject *)self)->string);
1890-
PyObject_GC_Del(self);
1891+
tp->tp_free(self);
1892+
Py_DECREF(tp);
18911893
}
18921894

18931895
static int
@@ -1959,9 +1961,11 @@ typedef struct {
19591961
static void
19601962
GBI_dealloc(PyObject *self)
19611963
{
1964+
PyTypeObject *tp = Py_TYPE(self);
19621965
PyObject_GC_UnTrack(self);
19631966
Py_DECREF(((GraphemeBreakIterator *)self)->iter.str);
1964-
PyObject_GC_Del(self);
1967+
tp->tp_free(self);
1968+
Py_DECREF(tp);
19651969
}
19661970

19671971
static int

0 commit comments

Comments
 (0)