]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix refleaks in new unicodedata classes added in gh-74902 (GH-143843)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 14 Jan 2026 19:55:11 +0000 (21:55 +0200)
committerGitHub <noreply@github.com>
Wed, 14 Jan 2026 19:55:11 +0000 (19:55 +0000)
Modules/unicodedata.c

index 669aa26aee5dc1bb397ce7163f4868942203f6e0..6904ee14811d48588389bd8579e9ac9708657d83 100644 (file)
@@ -1885,9 +1885,11 @@ typedef struct {
 static void
 Segment_dealloc(PyObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     Py_DECREF(((SegmentObject *)self)->string);
-    PyObject_GC_Del(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static int
@@ -1959,9 +1961,11 @@ typedef struct {
 static void
 GBI_dealloc(PyObject *self)
 {
+    PyTypeObject *tp = Py_TYPE(self);
     PyObject_GC_UnTrack(self);
     Py_DECREF(((GraphemeBreakIterator *)self)->iter.str);
-    PyObject_GC_Del(self);
+    tp->tp_free(self);
+    Py_DECREF(tp);
 }
 
 static int