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.
Showing the changes to tools/perf/scripts/python (3 of 4 files). Show all
Unified · Split
| @@ -45,8 +45,8 @@ parser = OptionParser(option_list=option_list) · 44 unmodified lines | |||
| 45 | # Initialize global dicts and regular expression | 45 | # Initialize global dicts and regular expression |
| 46 | disasm_cache = dict() | 46 | disasm_cache = dict() |
| 47 | cpu_data = dict() | 47 | cpu_data = dict() |
| 48 | disasm_re = re.compile("^\s*([0-9a-fA-F]+):") | 48 | disasm_re = re.compile(r"^\s*([0-9a-fA-F]+):") |
| 49 | disasm_func_re = re.compile("^\s*([0-9a-fA-F]+)\s.*:") | 49 | disasm_func_re = re.compile(r"^\s*([0-9a-fA-F]+)\s.*:") |
| 50 | cache_size = 64*1024 | 50 | cache_size = 64*1024 |
| 51 | 51 | ||
| 52 | glb_source_file_name = None | 52 | glb_source_file_name = None |
| @@ -260,7 +260,7 @@ def pr_help(): · 259 unmodified lines | |||
| 260 | 260 | ||
| 261 | comm_re = None | 261 | comm_re = None |
| 262 | pid_re = None | 262 | pid_re = None |
| 263 | pid_regex = "^(\d*)-(\d*)$|^(\d*)$" | 263 | pid_regex = r"^(\d*)-(\d*)$|^(\d*)$" |
| 264 | 264 | ||
| 265 | opt_proc = popt.DISP_DFL | 265 | opt_proc = popt.DISP_DFL |
| 266 | opt_disp = topt.DISP_ALL | 266 | opt_disp = topt.DISP_ALL |
| @@ -677,8 +677,8 @@ class CallGraphModelBase(TreeModel): · 676 unmodified lines | |||
| 677 | # sqlite supports GLOB (text only) which uses * and ? and is case sensitive | 677 | # sqlite supports GLOB (text only) which uses * and ? and is case sensitive |
| 678 | if not self.glb.dbref.is_sqlite3: | 678 | if not self.glb.dbref.is_sqlite3: |
| 679 | # Escape % and _ | 679 | # Escape % and _ |
| 680 | s = value.replace("%", "\%") | 680 | s = value.replace("%", "\\%") |
| 681 | s = s.replace("_", "\_") | 681 | s = s.replace("_", "\\_") |
| 682 | # Translate * and ? into SQL LIKE pattern characters % and _ | 682 | # Translate * and ? into SQL LIKE pattern characters % and _ |
| 683 | trans = string.maketrans("*?", "%_") | 683 | trans = string.maketrans("*?", "%_") |
| 684 | match = " LIKE '" + str(s).translate(trans) + "'" | 684 | match = " LIKE '" + str(s).translate(trans) + "'" |