mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-42972: Fully implement GC protocol for xxlimited (GH-26451) (GH-26460)
(cherry picked from commit 4b20f2574d)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
Co-authored-by: Hai Shi <shihai1992@gmail.com>
This commit is contained in:
parent
ff359d735f
commit
f097d2302b
2 changed files with 16 additions and 0 deletions
|
|
@ -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},
|
||||
|
|
|
|||
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue