-
-
Notifications
You must be signed in to change notification settings - Fork 31k
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
bpo-45811: Improve error message when source code contains invisible control characters #29654
Conversation
05785dd
to
568e6df
Compare
if (!Py_UNICODE_ISPRINTABLE(c)) { | ||
char hex[9]; | ||
(void)PyOS_snprintf(hex, sizeof(hex), "%04X", c); | ||
return syntaxerror(tok, "invalid non-printable character U+%s", hex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am keeping the error simple to keep it consistent with invalid non-printable characters in names
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
Example:
|
lel.py
Outdated
# -*- coding: cp437 -*- | ||
"¢¢¢¢¢¢" + f(4, x for x in range(1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is adding this to the repository root intended? What does it do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not intended, I forgot to push the commit that deleted this file
…control characters
…control characters (pythonGH-29654)
https://bugs.python.org/issue45811