https://github.com/python/cpython/commit/85013d7a558686b084f5ef9a2e1eaf99273c6be4
commit: 85013d7a558686b084f5ef9a2e1eaf99273c6be4
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-01-14T19:55:11Z
summary:

Fix refleaks in new unicodedata classes added in gh-74902 (GH-143843)

files:
M Modules/unicodedata.c

diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 669aa26aee5dc1..6904ee14811d48 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to