Patches item #1501979, was opened at 2006-06-07 04:49
Message generated for change (Comment added) made by sonderblade
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1501979&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: Parser/Compiler
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Roger Miller (rcmiller)
Assigned to: Nobody/Anonymous (nobody)
Summary: syntax errors on continuation lines

Initial Comment:
This patch modifies syntax error location information
to indicate when an error is detected on a statement
continuation line, for example
     File "test.py", line 42 (continuing line 41)
The intent is to be less confusing when an error
reported on one line is actually the result of
unbalanced brackets on a previous line.  The change
adds a new 'stmt_lineno' field to the SyntaxError
exception, containing the line number on which the
statement started.

The patch is against r46701 and was developed and
tested on Fedora 4 Linux.


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

Comment By: Bj�rn Lindqvist (sonderblade)
Date: 2007-03-13 00:33

Message:
Logged In: YES 
user_id=51702
Originator: NO

Works nicely:

>>> (3,
... 8,
... 4 +,
  File "<stdin>", line 3 (continuing line 1)
    4 +,
       ^
SyntaxError: invalid syntax

The patch does not apply cleanly because of changes in traceback.py, but
it is easy to fix. But IMHO, the special casing that checks for the
presence of the extra stmt_lineno attribute is not nice at all. I think it
would be better if stmt_lineno always was included and equal to lineno in
the normal case. Then traceback.py would just check if stmt_lineno differs
from lineno, and if so, append the extra '(continuing line %d)'
information.

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

Comment By: Georg Brandl (gbrandl)
Date: 2006-06-08 15:05

Message:
Logged In: YES 
user_id=849994

Note that you cannot give a "|" inside a tuple specification
in PyArg_ParseTuple.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1501979&group_id=5470
_______________________________________________
Patches mailing list
Patches@python.org
http://mail.python.org/mailman/listinfo/patches

Reply via email to