]> xenbits.xensource.com Git - xen.git/commitdiff
xen/x86: Fix Syntax warning in gen-cpuid.py
authorJason Andryuk <jason.andryuk@amd.com>
Tue, 30 Apr 2024 06:34:37 +0000 (08:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Apr 2024 06:34:37 +0000 (08:34 +0200)
Python 3.12.2 warns:

xen/tools/gen-cpuid.py:50: SyntaxWarning: invalid escape sequence '\s'
  "\s+([\s\d]+\*[\s\d]+\+[\s\d]+)\)"
xen/tools/gen-cpuid.py:51: SyntaxWarning: invalid escape sequence '\s'
  "\s+/\*([\w!]*) .*$")

Specify the strings as raw strings so '\s' is read as literal '\' + 's'.
This avoids escaping all the '\'s in the strings.

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/tools/gen-cpuid.py

index bf3f9ec01e6e061c09b38cb7833666db06a62901..dadeb3308076575a693a923fa703f854e594ed67 100755 (executable)
@@ -47,8 +47,8 @@ def parse_definitions(state):
     """
     feat_regex = re.compile(
         r"^XEN_CPUFEATURE\(([A-Z0-9_]+),"
-        "\s+([\s\d]+\*[\s\d]+\+[\s\d]+)\)"
-        "\s+/\*([\w!]*) .*$")
+        r"\s+([\s\d]+\*[\s\d]+\+[\s\d]+)\)"
+        r"\s+/\*([\w!]*) .*$")
 
     word_regex = re.compile(
         r"^/\* .* word (\d*) \*/$")