summaryrefslogtreecommitdiffstats
path: root/Modules/xxlimited.c
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2021-05-31 07:51:19 (GMT)
committerGitHub <noreply@github.com>2021-05-31 07:51:19 (GMT)
commit4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766 (patch)
tree8dc54773b165ae62156a9bb7bf85aad9502e5ae7 /Modules/xxlimited.c
parent8ab5b7eecaa1a1a249afbd3bf8358ce2b12e4713 (diff)
downloadcpython-4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766.zip
cpython-4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766.tar.gz
cpython-4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766.tar.bz2
bpo-42972: Fully implement GC protocol for xxlimited (GH-26451)
Diffstat (limited to 'Modules/xxlimited.c')
-rw-r--r--Modules/xxlimited.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c
index c3d98d3..9bd9a54 100644
--- a/Modules/xxlimited.c
+++ b/Modules/xxlimited.c
@@ -106,6 +106,13 @@ Xxo_traverse(XxoObject *self, visitproc visit, void *arg)
return 0;
}
+static int
+Xxo_clear(XxoObject *self)
+{
+ Py_CLEAR(self->x_attr);
+ return 0;
+}
+
static void
Xxo_finalize(XxoObject *self)
{
@@ -214,6 +221,7 @@ PyDoc_STRVAR(Xxo_doc,
static PyType_Slot Xxo_Type_slots[] = {
{Py_tp_doc, (char *)Xxo_doc},
{Py_tp_traverse, Xxo_traverse},
+ {Py_tp_clear, Xxo_clear},
{Py_tp_finalize, Xxo_finalize},
{Py_tp_dealloc, Xxo_dealloc},
{Py_tp_getattro, Xxo_getattro},