[issue31495] Wrong offset with IndentationError ("expected an indented block")

Martin Panter report at bugs.python.org
Sat Sep 16 19:11:52 EDT 2017


Martin Panter added the comment:

Some relevant info I wrote in Issue 25677:

‘The caret points to the character _before_ offset. . . . In some cases (e.g. the line “1 +”), the offset is the string index _after_ the error. But in the case of “1;1 + 1 = 2”, offset is the index where the error (statement) begins.’

In this case it looks like the offset is of the end of the first word on the line that has the wrong indentation. The caret is positioned one position back, to point at the last character of that word.

----------
nosy: +martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31495>
_______________________________________


More information about the Python-bugs-list mailing list