Skip to content
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

[UTC] Fix SyntaxWarning on Python 3.12 #82327

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

lukel97
Copy link
Contributor

@lukel97 lukel97 commented Feb 20, 2024

On Python 3.12 we now get a warning in common.py:

llvm/utils/UpdateTestChecks/common.py:488: SyntaxWarning: invalid escape sequence '\s'

This fixes it by using a raw string literal, see
#78036 and
https://docs.python.org/3/library/re.html

On Python 3.12 we now get a warning in common.py:

llvm/utils/UpdateTestChecks/common.py:488: SyntaxWarning: invalid escape sequence '\s'

This fixes it by using a raw string literal, see
llvm#78036 and
https://docs.python.org/3/library/re.html
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 20, 2024

@llvm/pr-subscribers-testing-tools

Author: Luke Lau (lukel97)

Changes

On Python 3.12 we now get a warning in common.py:

llvm/utils/UpdateTestChecks/common.py:488: SyntaxWarning: invalid escape sequence '\s'

This fixes it by using a raw string literal, see
#78036 and
https://docs.python.org/3/library/re.html


Full diff: https://github.com/llvm/llvm-project/pull/82327.diff

1 Files Affected:

  • (modified) llvm/utils/UpdateTestChecks/common.py (+1-1)
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 75c6e438556337..4a02a92f824e65 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -485,7 +485,7 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
 )
 
 UTC_ARGS_KEY = "UTC_ARGS:"
-UTC_ARGS_CMD = re.compile(r".*" + UTC_ARGS_KEY + "\s*(?P<cmd>.*)\s*$")
+UTC_ARGS_CMD = re.compile(r".*" + UTC_ARGS_KEY + r"\s*(?P<cmd>.*)\s*$")
 UTC_ADVERT = "NOTE: Assertions have been autogenerated by "
 UTC_AVOID = "NOTE: Do not autogenerate"
 UNUSED_NOTE = "NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:"

@lukel97 lukel97 merged commit 283a6b9 into llvm:main Feb 20, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants