Skip to content

Commit a4665b5

Browse files
serhiy-storchakaStanFromIreland
authored andcommitted
Fix refleaks in new unicodedata classes added in gh-74902 (GH-143843)
1 parent f413b87 commit a4665b5

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
@@ -1875,9 +1875,11 @@ typedef struct {
18751875
static void
18761876
Segment_dealloc(PyObject *self)
18771877
{
1878+
PyTypeObject *tp = Py_TYPE(self);
18781879
PyObject_GC_UnTrack(self);
18791880
Py_DECREF(((SegmentObject *)self)->string);
1880-
PyObject_GC_Del(self);
1881+
tp->tp_free(self);
1882+
Py_DECREF(tp);
18811883
}
18821884

18831885
static int
@@ -1949,9 +1951,11 @@ typedef struct {
19491951
static void
19501952
GBI_dealloc(PyObject *self)
19511953
{
1954+
PyTypeObject *tp = Py_TYPE(self);
19521955
PyObject_GC_UnTrack(self);
19531956
Py_DECREF(((GraphemeBreakIterator *)self)->iter.str);
1954-
PyObject_GC_Del(self);
1957+
tp->tp_free(self);
1958+
Py_DECREF(tp);
19551959
}
19561960

19571961
static int

0 commit comments

Comments
 (0)