Bugs item #1447885, was opened at 2006-03-11 14:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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.

----------------------------------------------------------------------

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

Reply via email to