Skip to content

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

Merged
miss-islington merged 5 commits into
python:masterfrom
isidentical:bpo-40176
Jan 20, 2021
Merged

bpo-40176: Improve error messages for unclosed string literals#19346
miss-islington merged 5 commits into
python:masterfrom
isidentical:bpo-40176

Conversation

@isidentical

@isidentical isidentical commented Apr 3, 2020

Copy link
Copy Markdown
Member

https://bugs.python.org/issue40176

Automerge-Triggered-By: GH:isidentical

@ammaraskar

Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread Lib/test/test_eof.py Outdated
@cfbolz

cfbolz commented Jan 20, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member Author

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

@cfbolz

cfbolz commented Jan 20, 2021

Copy link
Copy Markdown
Contributor

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

Comment thread Misc/NEWS.d/next/Core and Builtins/2021-01-20-22-31-01.bpo-40176.anjyWw.rst Outdated

@pablogsal pablogsal left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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