Serhiy Storchaka added the comment: Oh, I see many other issues with C implementation of ElementTree.
1. If XMLParser.__init__ is called twice, it leaks references and the Expat parser. Possible solution: use the Py_XSETREF() macro instead of simple assignment. The Expat parser needs special handling. Other possible solution: drop __init__() and make all initialization in __new__(). But this is a solution only for 3.7 because can break compatibility. 2. If XMLParser.__init__ is not called or if it fails to initialize the Expat parser, self->entity and self->target are NULL. Later in xmlparser_getattro() they are increfed unconditionally. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31455> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com