Skip to content

Reject bidirectional formatting characters #11391

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 2 commits into from
Nov 15, 2021
Merged

Reject bidirectional formatting characters #11391

merged 2 commits into from
Nov 15, 2021

Conversation

josevalim
Copy link
Member

No description provided.

@fertapric
Copy link
Member

@josevalim
Copy link
Member Author

@fertapric yes, that's a separate problem. Ideally we will merge this with the existing StringTokenizer. We don't need to keep all confusables, only the confusables that are currently valid as identifiers. And we can probably do it all with a single pass.

assert_eval_raise SyntaxError,
~r"nofile:1:13: invalid bidirectional formatting character in string: \\u202A. If you want to use such character, use it in its escaped \\u202A form instead",
'"this is a \\\u202A"'
end
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a test that it is accepted in escaped form?

Copy link
Member Author

Choose a reason for hiding this comment

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

My answer would be no. We always accept any encoded form.

@josevalim josevalim merged commit 39121ad into main Nov 15, 2021
@josevalim josevalim deleted the jv-invalid-bidi branch November 15, 2021 20:08
@josevalim
Copy link
Member Author

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants