Naftali Harris added the comment: Two other minor discrepancies between the way traceback and the interpreter format SyntaxError's, in 2.7.13:
1. >>> e = SyntaxError("some message", ("myfile.py", None, None, None)) >>> raise e Traceback (most recent call last): File "<stdin>", line 1, in <module> SyntaxError: some message (myfile.py) >>> try: ... raise e ... except: ... traceback.print_exc() ... Traceback (most recent call last): File "<stdin>", line 2, in <module> Traceback (most recent call last): File "<stdin>", line 4, in <module> File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 233, in print_exc print_exception(etype, value, tb, limit, file) File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 126, in print_exception lines = format_exception_only(etype, value) File "/Users/naftali/repos/Python-2.7.13/Lib/traceback.py", line 188, in format_exception_only lines.append(' File "%s", line %d\n' % (filename, lineno)) TypeError: %d format: a number is required, not NoneType 2. >>> e = SyntaxError("some message", ("myfile.py", 3, 10, "hello")) >>> raise e Traceback (most recent call last): File "<stdin>", line 1, in <module> File "myfile.py", line 3 hello ^ SyntaxError: some message >>> try: ... raise e ... except: ... traceback.print_exc() ... Traceback (most recent call last): File "<stdin>", line 2, in <module> File "myfile.py", line 3 hello ^ SyntaxError: some message ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29107> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com