Terry J. Reedy <tjre...@udel.edu> added the comment:

I verified that 3.8 puts the caret under '|', and agree that this is bug that 
should be fixed at least in a new version.  Other such bugs have been fixed in 
the past.

tk Text widgets have 1-based line numbers and 0-based column numbers. The 
latter is appropriate since column indexes mostly serve as slice positions 
rather than as character positions.  IDLE changes the background of the error 
character to red, so it must be subtracting 1 to get the beginning of the slice 
to be colored.  There was once a bug about this, so having the CPython behavior 
be consistent and documented would be good even if not a language feature.  
(For some reason I have not yet tracked down, IDLE colors the \n in 3.8 as well 
as 3.9, but is also correct and consistent for other exceptions where the two 
versions report the same column.)

On a related note: Since the exceptions raised by compile are not restricted to 
SyntaxError (or Warning), it would be nice to have them restricted to a 
definite list that is documented.  Both code.InteractiveInterpreter and IDLE 
have try-compile-except with (different) tuples extended as uncaught exceptions 
are reported.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40546>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to