Roundup Robot added the comment:
New changeset 6d1372237607 by Florent Xicluna in branch '3.3':
Issue #17825: Cursor ^ is correctly positioned for SyntaxError and
IndentationError.
http://hg.python.org/cpython/rev/6d1372237607
--
nosy: +python-dev
Roundup Robot added the comment:
New changeset aeb204b8f6c4 by Florent Xicluna in branch 'default':
Issue #17825: Cursor ^ is correctly positioned for SyntaxError and
IndentationError.
http://hg.python.org/cpython/rev/aeb204b8f6c4
--
___
Python
Roundup Robot added the comment:
New changeset 0041be34edbf by Florent Xicluna in branch '2.7':
Issue #17825: Cursor ^ is correctly positioned for SyntaxError and
IndentationError.
http://hg.python.org/cpython/rev/0041be34edbf
--
___
Python tracker
Florent Xicluna added the comment:
Done.
The alignment error with non-ASCII chars should be fixed too, thanks to the
work of Serhiy on issue #2382.
--
resolution: - fixed
status: open - closed
___
Python tracker rep...@bugs.python.org
Serhiy Storchaka added the comment:
Florent, can you commit your patch?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
___
Serhiy Storchaka added the comment:
patch_indenterror_offset_v2.diff LGTM.
--
stage: - commit review
versions: +Python 2.7, Python 3.3
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
Florent Xicluna added the comment:
Patch updated with latest changes of trunk.
--
Added file: http://bugs.python.org/file30081/patch_indenterror_offset_v2.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
Changes by Florent Xicluna florent.xicl...@gmail.com:
--
components: +Interpreter Core, Library (Lib)
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
Ezio Melotti added the comment:
I tried a few different lines that result in a syntax error and the position of
the '^' always seems ok to me, so I'm not sure there's any bug here:
foo:bar
^
from import *
^
try:+
^
try+
^
1?
^
Changes by Terry J. Reedy tjre...@udel.edu:
--
resolution: - works for me
status: open - closed
type: behavior - enhancement
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
Florent Xicluna added the comment:
Hello again,
actually, the attached script demonstrates some issues with the computation of
the offset.
In rare cases, the computed offset does not match the position of the caret '^'
in the traceback. It makes it difficult to reuse exc.offset to display
Florent Xicluna added the comment:
And this additional script (test_indenterror.py) demonstrates a different issue
in the traceback module.
--
Added file: http://bugs.python.org/file30034/test_indenterror.py
___
Python tracker rep...@bugs.python.org
Changes by Florent Xicluna florent.xicl...@gmail.com:
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
___
Serhiy Storchaka added the comment:
Indeed, there is an inconsistence between the traceback module and builtin
exception print function. Behavior of traceback is intentional as noted in
format_exception_only() (if this comment is not misleading).
--
nosy: +georg.brandl,
Florent Xicluna added the comment:
The proposed patch deals with the case of the IndentationError in the traceback
module.
--
keywords: +patch
resolution: works for me -
Added file: http://bugs.python.org/file30036/patch_indenterror_offset.diff
___
Changes by Florent Xicluna florent.xicl...@gmail.com:
Removed file: http://bugs.python.org/file30036/patch_indenterror_offset.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
Changes by Florent Xicluna florent.xicl...@gmail.com:
Added file: http://bugs.python.org/file30037/patch_indenterror_offset.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
___
Serhiy Storchaka added the comment:
Your diff file looks broken.
I'm not sure it's the traceback module should be fixed and not Python
internals. Georg, what you say?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17825
Florent Xicluna added the comment:
The previous patch fixes some cases where the caret was wrongly positioned.
However, there's probably stuff to fix in Python internals too.
See attached test cases (test_traceback_caret.py) which demonstrates other
issues with non-ASCII chars or tab in the
Terry J. Reedy added the comment:
Perhaps Florent is pointing to the fact that for 'except X:', the syntax error
is detected at the ' ' at offset 6 but the caret is backed up under the 't' at
offset 5*, whereas it is not backed up to the space before 'open'. Which
behavior do you propose
New submission from Florent Xicluna:
I noticed a difference between computation of column offset for SyntaxError and
IndentationError (a subclass of SyntaxError).
It is slightly confusing.
def report(exc):
print('lineno %s, offset %s' % (exc.lineno, exc.offset))
raise
try:
R. David Murray added the comment:
Well, that would be because the invalid indent is detected when the 'o' is
encountered, whereas the invalid syntax is detected when the 't' completes the
keyword 'except'.
I don't think there is a bug here.
--
nosy: +r.david.murray
22 matches
Mail list logo