Skip to content

Commit 51eba29

Browse files
markmentovaiCrashpad LUCI CQ
authored and
Crashpad LUCI CQ
committed
Fix Python 3.13 re DeprecationWarning: pass count and flags by keyword
https://docs.python.org/3/library/re.html: > Deprecated since version 3.13: Passing count and flags as positional > arguments is deprecated. In future Python versions they will be > keyword-only parameters. python/cpython#56166, python/cpython#107778, https://docs.python.org/3/whatsnew/3.13.html#:~:text=gh%2D66543.)-,re%3A,-Deprecate%20passing%20the Change-Id: Ibda1394927062dd9e0353e2b9d643b510070deb6 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/6298792 Reviewed-by: Leonard Grey <lgrey@chromium.org> Commit-Queue: Mark Mentovai <mark@chromium.org>
1 parent 4d14c1b commit 51eba29

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

build/run_tests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ def _BinaryDirTargetOS(binary_dir):
8989
if os.path.exists(build_ninja_path):
9090
with open(build_ninja_path) as build_ninja_file:
9191
build_ninja_content = build_ninja_file.read()
92-
match = re.search(r'-linux-android(eabi)?-ar$', build_ninja_content,
93-
re.MULTILINE)
92+
match = re.search(r'-linux-android(eabi)?-ar$',
93+
build_ninja_content,
94+
flags=re.MULTILINE)
9495
if match:
9596
return 'android'
9697

snapshot/win/end_to_end_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def __init__(self, cdb_path, dump_path, command):
237237
[cdb_path, '-z', dump_path, '-c', command + ';q'], text=True)
238238

239239
def Check(self, pattern, message, re_flags=0, must_not_match=False):
240-
match_obj = re.search(pattern, self.out, re_flags)
240+
match_obj = re.search(pattern, self.out, flags=re_flags)
241241
if match_obj and not must_not_match:
242242
# Matched. Consume up to end of match.
243243
self.out = self.out[match_obj.end(0):]
@@ -263,7 +263,7 @@ def Check(self, pattern, message, re_flags=0, must_not_match=False):
263263
g_had_failures = True
264264

265265
def Find(self, pattern, re_flags=0):
266-
match_obj = re.search(pattern, self.out, re_flags)
266+
match_obj = re.search(pattern, self.out, flags=re_flags)
267267
if match_obj:
268268
# Matched. Consume up to end of match.
269269
self.out = self.out[match_obj.end(0):]

util/mach/mig_fix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def _fix_user_implementation(implementation, fixed_implementation, header,
6969
file = open(implementation, 'r+' if fixed_implementation is None else 'r')
7070
contents = file.read()
7171

72-
pattern = re.compile('^(\t} __Reply);$', re.MULTILINE)
72+
pattern = re.compile('^(\t} __Reply);$', flags=re.MULTILINE)
7373
contents = pattern.sub(r'\1 __attribute__((unused));', contents)
7474

7575
if fixed_header is not None:
@@ -112,7 +112,7 @@ def _fix_server_implementation(implementation, fixed_implementation, header,
112112

113113
# Find interesting declarations.
114114
declaration_pattern = re.compile(
115-
'^mig_internal (kern_return_t __MIG_check__.*)$', re.MULTILINE)
115+
'^mig_internal (kern_return_t __MIG_check__.*)$', flags=re.MULTILINE)
116116
declarations = declaration_pattern.findall(contents)
117117

118118
# Remove “__attribute__((__unused__))” from the declarations, and call them

0 commit comments

Comments
 (0)