[issue42577] Unhelpful syntax error when expression spans multiple lines

Lysandros Nikolaou report at bugs.python.org
Mon Dec 14 18:35:53 EST 2020


Lysandros Nikolaou <lisandrosnik at gmail.com> added the comment:

Thanks for opening an issue here, Christoph. This is the right place to discuss this.

Indeed the parser is pretty dumb when reporting errors. In the technical sense the colon is the right thing to point to, since it's the first token that's not grammatically correct. Of course, it's somewhat misleading that it points to a line that *seems* correct, but that probably as good as we can do with the parser's current error reporting mechanisms.

Showing more that one lines would indeed solve this specific case, but implementing this is also difficult and I don't think it's worth it for such an edge case.

Guido, Pablo, your views on this?

----------
nosy: +gvanrossum, lys.nikolaou, pablogsal

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


More information about the Python-bugs-list mailing list