Skip to content

Commit 9210a36

Browse files
author
Erlend E. Aasland
committed
Visit type in type traverse functions
1 parent 959a225 commit 9210a36

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/_elementtree.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ subelement(PyObject *self, PyObject *args, PyObject *kwds)
633633
static int
634634
element_gc_traverse(ElementObject *self, visitproc visit, void *arg)
635635
{
636+
Py_VISIT(Py_TYPE(self));
636637
Py_VISIT(self->tag);
637638
Py_VISIT(JOIN_OBJ(self->text));
638639
Py_VISIT(JOIN_OBJ(self->tail));
@@ -2096,7 +2097,7 @@ elementiter_dealloc(ElementIterObject *it)
20962097
Py_XDECREF(it->sought_tag);
20972098
Py_XDECREF(it->root_element);
20982099

2099-
PyObject_GC_Del(it);
2100+
tp->tp_free(it);
21002101
Py_DECREF(tp);
21012102
}
21022103

@@ -2109,6 +2110,7 @@ elementiter_traverse(ElementIterObject *it, visitproc visit, void *arg)
21092110

21102111
Py_VISIT(it->root_element);
21112112
Py_VISIT(it->sought_tag);
2113+
Py_VISIT(Py_TYPE(it));
21122114
return 0;
21132115
}
21142116

@@ -2422,6 +2424,7 @@ _elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
24222424
static int
24232425
treebuilder_gc_traverse(TreeBuilderObject *self, visitproc visit, void *arg)
24242426
{
2427+
Py_VISIT(Py_TYPE(self));
24252428
Py_VISIT(self->pi_event_obj);
24262429
Py_VISIT(self->comment_event_obj);
24272430
Py_VISIT(self->end_ns_event_obj);
@@ -3736,6 +3739,7 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
37363739
static int
37373740
xmlparser_gc_traverse(XMLParserObject *self, visitproc visit, void *arg)
37383741
{
3742+
Py_VISIT(Py_TYPE(self));
37393743
Py_VISIT(self->handle_close);
37403744
Py_VISIT(self->handle_pi);
37413745
Py_VISIT(self->handle_comment);

0 commit comments

Comments
 (0)