[llvm] [UTC] Fix SyntaxWarning on Python 3.12 (PR #82327)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 01:28:41 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-testing-tools

Author: Luke Lau (lukel97)

<details>
<summary>Changes</summary>

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


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


1 Files Affected:

- (modified) llvm/utils/UpdateTestChecks/common.py (+1-1) 


``````````diff
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:"

``````````

</details>


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


More information about the llvm-commits mailing list