[llvm] [UTC] Fix SyntaxWarning on Python 3.12 (PR #82327)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 20 01:28:11 PST 2024
https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/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
>From c9244f0752b80f393c5f1a645f33f0dadd726758 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Tue, 20 Feb 2024 17:23:15 +0800
Subject: [PATCH] [UTC] Fix SyntaxWarning on Python 3.12
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
---
llvm/utils/UpdateTestChecks/common.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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