Skip to content

Commit 66b77e0

Browse files
committed
Add comment about Py_CLEAR(self->parent) to xmlparse_clear
1 parent 6d3c424 commit 66b77e0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/pyexpat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,6 +1545,11 @@ xmlparse_clear(PyObject *op)
15451545
xmlparseobject *self = xmlparseobject_CAST(op);
15461546
clear_handlers(self, 0);
15471547
Py_CLEAR(self->intern);
1548+
// NOTE: We cannot call Py_CLEAR(self->parent) prior to calling
1549+
// XML_ParserFree(self->itself) or a subparser (created via
1550+
// XML_ExternalEntityParserCreate could lose its parent XML_Parser
1551+
// while still making use of it internally.
1552+
// https://github.com/python/cpython/issues/139400
15481553
return 0;
15491554
}
15501555

0 commit comments

Comments
 (0)