[llvm] 283a6b9 - [UTC] Fix SyntaxWarning on Python 3.12 (#82327)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 01:36:05 PST 2024


Author: Luke Lau
Date: 2024-02-20T17:36:01+08:00
New Revision: 283a6b9936657712f61c38459c87507e587e3625

URL: https://github.com/llvm/llvm-project/commit/283a6b9936657712f61c38459c87507e587e3625
DIFF: https://github.com/llvm/llvm-project/commit/283a6b9936657712f61c38459c87507e587e3625.diff

LOG: [UTC] Fix SyntaxWarning on Python 3.12 (#82327)

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
https://github.com/llvm/llvm-project/pull/78036 and
https://docs.python.org/3/library/re.html

Added: 
    

Modified: 
    llvm/utils/UpdateTestChecks/common.py

Removed: 
    


################################################################################
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:"


        


More information about the llvm-commits mailing list