Skip to content

bpo-40176: Improve error messages for unclosed string literals #19346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 20, 2021

Conversation

isidentical
Copy link
Member

@isidentical isidentical commented Apr 3, 2020

https://bugs.python.org/issue40176

Automerge-Triggered-By: GH:isidentical

@ammaraskar
Copy link
Member

This message is still a bit jargon-y, I think Rust's error message in this case is pretty nice:

error: unterminated double quote string
 --> src/main.rs:2:19
  |
2 |       let message = "Hello world
  |  ___________________^
3 | |     println!(message);
4 | | }
  | |_^

@isidentical
Copy link
Member Author

This message is still a bit jargon-y, I think Rust's error message in this case is pretty nice:

That definitely looks more simpler to those who unfamiliar with parser jargon. I'm not sure if we should still use EOF/EOL when needed or not though.

@isidentical isidentical force-pushed the bpo-40176 branch 4 times, most recently from c75e26e to 0b6386d Compare April 4, 2020 02:23
@cfbolz
Copy link
Contributor

cfbolz commented Jan 20, 2021

as a data point my (non-cs) students always get confused by the EOF and EOL abbreviation. PyPy's message is:
end of file (EOF) while scanning triple-quoted string literal

@isidentical
Copy link
Member Author

we actually don't use EOF/EOL anymore, just "unterminated string literal"

@cfbolz
Copy link
Contributor

cfbolz commented Jan 20, 2021

ah great (sorry, hadn't read the diff yet, just saw the earlier comment)

Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Feel free to land once you address the minor comment

@miss-islington
Copy link
Contributor

@isidentical: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit a698d52 into python:master Jan 20, 2021
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants