[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-15 Thread Guido van Rossum
Guido van Rossum added the comment: I think something should probably be done about this, but opening another tracker issue is not the way to make progress here. So I am closing the issue. It will happen in due time. No need to have more open issues. -- stage: -> resolved status: op

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-15 Thread Pablo Galindo Salgado
Pablo Galindo Salgado added the comment: I concur, handling also multi-line constructs is tricky and I would prefer not to implement some hack for specific situations because my experience is that balancing that with other things Is tricky. As Lysandros mentioned, the parser reports correctl

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-14 Thread Lysandros Nikolaou
Lysandros Nikolaou 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 grammati

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-11 Thread Christoph Reiter
Christoph Reiter added the comment: I would expect Python to print the current statement up to the error instead of just the last line: ``` File "error.py", line 3-5 print(((123)) if 2: ^ ``` This would solve this case nicely while in the common case still show one line a

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-11 Thread Andre Roberge
Andre Roberge added the comment: I suspect that the Python parser cannot easily be changed to given any other message. Replace the colon by "else" and add one more closing parenthesis and you have a valid Python program. So, is it a matter of an unclosed parenthesis, or not using "else" ? .

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-05 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> duplicate superseder: -> Line number of SyntaxError ___ Python tracker ___ ___ Python-b

[issue42577] Unhelpful syntax error when expression spans multiple lines

2020-12-05 Thread Christoph Reiter
New submission from Christoph Reiter : I don't know if the bug tracker is the right place for this, please point me to the right place if not. Someone faced to the following code (simplified example here) and asked for help: ``` if 3: if 1: print(((123)) if 2: print(123) ```