diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-31 11:23:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-31 11:23:13 (GMT) |
commit | f097d2302be46b031687726011b86fc241a042ef (patch) | |
tree | 71ae87d9c9200fc3d89f3f1f18b401bed94c13a5 /Modules | |
parent | ff359d735f1a60878975d1c5751bfd2361e84067 (diff) | |
download | cpython-f097d2302be46b031687726011b86fc241a042ef.zip cpython-f097d2302be46b031687726011b86fc241a042ef.tar.gz cpython-f097d2302be46b031687726011b86fc241a042ef.tar.bz2 |
bpo-42972: Fully implement GC protocol for xxlimited (GH-26451) (GH-26460)
(cherry picked from commit 4b20f2574d412f4c4a5b1ab799d8e71a5dd3b766)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
Co-authored-by: Hai Shi <shihai1992@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/xxlimited.c | 8 | ||||
-rw-r--r-- | Modules/xxlimited_35.c | 8 |
2 files changed, 16 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}, diff --git a/Modules/xxlimited_35.c b/Modules/xxlimited_35.c index 5e93854..647abf6 100644 --- a/Modules/xxlimited_35.c +++ b/Modules/xxlimited_35.c @@ -43,6 +43,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) { @@ -108,6 +115,7 @@ Xxo_setattr(XxoObject *self, const char *name, PyObject *v) static PyType_Slot Xxo_Type_slots[] = { {Py_tp_doc, "The Xxo type"}, {Py_tp_traverse, Xxo_traverse}, + {Py_tp_clear, Xxo_clear}, {Py_tp_finalize, Xxo_finalize}, {Py_tp_getattro, Xxo_getattro}, {Py_tp_setattr, Xxo_setattr}, |