Skip to content

[Python] Use raw string literals for regexes #120401

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 1 commit into from
Dec 18, 2024

Conversation

ostannard
Copy link
Collaborator

Previously these backslashes were not followed by a valid escape sequence character so were treated as literal backslashes, which was the intended behaviour of the code. However python as of 3.12 has started warning about these, so we should use raw string literals for regexes so that backslashes are always interpreted literally. I've done this for every regex in this file for consistency, including the ones which do not contain backslashes.

Previously these backslashes were not followed by a valid escape sequence
character so were treated as literal backslashes, which was the intended
behavior of the code. However python as of 3.12 has started warning
about these, so we should use raw string literals for regexes so that
backslashes are always interpreted literally. I've done this for every
regex in this file for consistency, including the ones which do not
contain backslashes.
Copy link
Collaborator

@zmodem zmodem left a comment

Choose a reason for hiding this comment

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

lgtm

Thanks!

@ostannard ostannard merged commit e7303fe into llvm:main Dec 18, 2024
9 checks passed
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.

2 participants