]> Git Repo - linux.git/commitdiff
perf tools: Address python 3.6 DeprecationWarning for string scapes
authorBenjamin Gray <[email protected]>
Tue, 12 Sep 2023 06:07:59 +0000 (16:07 +1000)
committerArnaldo Carvalho de Melo <[email protected]>
Thu, 23 Nov 2023 13:56:09 +0000 (10:56 -0300)
Python 3.6 introduced a DeprecationWarning for invalid escape sequences.
This is upgraded to a SyntaxWarning in Python 3.12, and will eventually
be a syntax error.

Fix these now to get ahead of it before it's an error.

Signed-off-by: Benjamin Gray <[email protected]>
Acked-by: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Hartley Sweeten <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jan Kiszka <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Kieran Bingham <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Mykola Lysenko <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Todd E Brandt <[email protected]>
Cc: Tom Rix <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/pmu-events/jevents.py
tools/perf/scripts/python/arm-cs-trace-disasm.py
tools/perf/scripts/python/compaction-times.py
tools/perf/scripts/python/exported-sql-viewer.py

index 3c091ab753059072973a37cc19a89e2ef0f0c8af..0093c998cb6e6ed4eec468a4f5cc5281e218a21f 100755 (executable)
@@ -83,7 +83,7 @@ def c_len(s: str) -> int:
   """Return the length of s a C string
 
   This doesn't handle all escape characters properly. It first assumes
-  all \ are for escaping, it then adjusts as it will have over counted
+  all \\ are for escaping, it then adjusts as it will have over counted
   \\. The code uses \000 rather than \0 as a terminator as an adjacent
   number would be folded into a string of \0 (ie. "\0" + "5" doesn't
   equal a terminator followed by the number 5 but the escape of
index d59ff53f1d946c01e59038f353b5658658dee1e7..de58991c78bb41fa895e888d3516a5d652517adf 100755 (executable)
@@ -45,8 +45,8 @@ parser = OptionParser(option_list=option_list)
 # Initialize global dicts and regular expression
 disasm_cache = dict()
 cpu_data = dict()
-disasm_re = re.compile("^\s*([0-9a-fA-F]+):")
-disasm_func_re = re.compile("^\s*([0-9a-fA-F]+)\s.*:")
+disasm_re = re.compile(r"^\s*([0-9a-fA-F]+):")
+disasm_func_re = re.compile(r"^\s*([0-9a-fA-F]+)\s.*:")
 cache_size = 64*1024
 
 glb_source_file_name   = None
index 2560a042dc6fa4e9c0cd80dd8b5f068117be9082..9401f7c14747788f7f1e4617fb22354819785a46 100644 (file)
@@ -260,7 +260,7 @@ def pr_help():
 
 comm_re = None
 pid_re = None
-pid_regex = "^(\d*)-(\d*)$|^(\d*)$"
+pid_regex = r"^(\d*)-(\d*)$|^(\d*)$"
 
 opt_proc = popt.DISP_DFL
 opt_disp = topt.DISP_ALL
index 13f2d8a8161096e8f8f9b691146629dafeee4538..121cf61ba1b345f579e2db83f1dfb586e8d88ec7 100755 (executable)
@@ -677,8 +677,8 @@ class CallGraphModelBase(TreeModel):
                        #   sqlite supports GLOB (text only) which uses * and ? and is case sensitive
                        if not self.glb.dbref.is_sqlite3:
                                # Escape % and _
-                               s = value.replace("%", "\%")
-                               s = s.replace("_", "\_")
+                               s = value.replace("%", "\\%")
+                               s = s.replace("_", "\\_")
                                # Translate * and ? into SQL LIKE pattern characters % and _
                                trans = string.maketrans("*?", "%_")
                                match = " LIKE '" + str(s).translate(trans) + "'"
This page took 0.068731 seconds and 4 git commands to generate.