This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jamercee
Recipients jamercee
Date 2019-10-28.09:11:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572253875.02.0.816082787085.issue38611@roundup.psfhosted.org>
In-reply-to
Content
_elementtree.c defines a custom exception 'xml.etree.ElementTree.ParseError' that inherits from SyntaxError. According to the docs https://docs.python.org/3/library/exceptions.html#SyntaxError

``Instances of this class have attributes filename, lineno, offset and text for easier access to the details.``

The ElementTree.Parser does not provide these extra attributes. While unittesting a badly formatted string passed to ET.fromstring(), the unittests/results.py module passes the exception to traceback.py, which attempts to extract the members causing it to raise a new exception.

Either ElementTree.Parser should be raising something other than SyntaxErrors, or it should be providing the required attributes, or traceback.py needs to be more flexible and test for the extra attributes before accessing.

I'm willing to submit a patch, but before diving in, wasn't sure which path people would prefer to see fixed?

The code in traceback.py is from lines 516 - 521.
History
Date User Action Args
2019-10-28 09:11:15jamerceesetrecipients: + jamercee
2019-10-28 09:11:15jamerceesetmessageid: <1572253875.02.0.816082787085.issue38611@roundup.psfhosted.org>
2019-10-28 09:11:14jamerceelinkissue38611 messages
2019-10-28 09:11:13jamerceecreate