New submission from Jim Carroll <j...@carroll.com>:
_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. ---------- components: Library (Lib) messages: 355518 nosy: jamercee priority: normal severity: normal status: open title: Bug in traceback.py versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38611> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com