Bugs item #1447885, was opened at 2006-03-11 13:46 Message generated for change (Comment added) made by gbrandl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1447885&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Remy Blank (remyblank) Assigned to: Nobody/Anonymous (nobody) Summary: traceback.format_exception_only() and SyntaxError Initial Comment: There is a special case in traceback.format_exception_only() for SyntaxError so that the location of the syntax error is printed. Unfortunately, the test is written so that it only works with SyntaxError, but not for children of SyntaxError, e.g. IndentationError. OTOH, the interpreter prints the correct output if the exception is allowed to terminate the program. I have attached a test case that shows the difference in output. With the current traceback.py module, the output is different: [EMAIL PROTECTED] py $ ./testSyntaxError.py Traceback (most recent call last): File "./testSyntaxError.py", line 7, in ? import SyntaxErr IndentationError: expected an indented block (SyntaxErr.py, line 2) [EMAIL PROTECTED] py $ ./testSyntaxError.py raise Traceback (most recent call last): File "./testSyntaxError.py", line 7, in ? import SyntaxErr File "/home/joe/tmp/py/SyntaxErr.py", line 2 class OtherClass: ^ IndentationError: expected an indented block There's a second file that is needed for the test case, I'll attach it as well. ---------------------------------------------------------------------- >Comment By: Georg Brandl (gbrandl) Date: 2006-03-31 15:59 Message: Logged In: YES user_id=849994 Fixed in rev. 43486. Thanks! ---------------------------------------------------------------------- Comment By: Remy Blank (remyblank) Date: 2006-03-11 13:51 Message: Logged In: YES user_id=568100 This patch makes both the output of the interpreter and the output generated by format_exception_only() identical. ---------------------------------------------------------------------- Comment By: Remy Blank (remyblank) Date: 2006-03-11 13:47 Message: Logged In: YES user_id=568100 This file generates the IndentationError. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1447885&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com