Skip to content

Commit

Permalink
Visit type in type traverse functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Erlend E. Aasland committed Jan 11, 2021
1 parent 959a225 commit 9210a36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Modules/_elementtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ subelement(PyObject *self, PyObject *args, PyObject *kwds)
static int
element_gc_traverse(ElementObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->tag);
Py_VISIT(JOIN_OBJ(self->text));
Py_VISIT(JOIN_OBJ(self->tail));
Expand Down Expand Up @@ -2096,7 +2097,7 @@ elementiter_dealloc(ElementIterObject *it)
Py_XDECREF(it->sought_tag);
Py_XDECREF(it->root_element);

PyObject_GC_Del(it);
tp->tp_free(it);
Py_DECREF(tp);
}

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

Py_VISIT(it->root_element);
Py_VISIT(it->sought_tag);
Py_VISIT(Py_TYPE(it));
return 0;
}

Expand Down Expand Up @@ -2422,6 +2424,7 @@ _elementtree_TreeBuilder___init___impl(TreeBuilderObject *self,
static int
treebuilder_gc_traverse(TreeBuilderObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->pi_event_obj);
Py_VISIT(self->comment_event_obj);
Py_VISIT(self->end_ns_event_obj);
Expand Down Expand Up @@ -3736,6 +3739,7 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
static int
xmlparser_gc_traverse(XMLParserObject *self, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(self));
Py_VISIT(self->handle_close);
Py_VISIT(self->handle_pi);
Py_VISIT(self->handle_comment);
Expand Down

0 comments on commit 9210a36

Please sign in to comment.