Skip to content

Commit f074995

Browse files
committed
test: partially undo changes to PathSanitizingFileCheck
The regular expression engine escaped the strings differently across python 2 and 3. Using a raw string makes this simpler to understand and obsoletes the comment. This change also now properly allows the replacement to occur in the same way on 2 and 3.
1 parent 69ff5be commit f074995

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

utils/PathSanitizingFileCheck

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ constants.""")
8080
# Since we want to use pattern as a regex in some platforms, we need
8181
# to escape it first, and then replace the escaped slash
8282
# literal (r'\\/') for our platform-dependent slash regex.
83-
stdin = re.sub(re.sub('\\\\/' if sys.version_info[0] < 3 else r'[/\\]',
83+
stdin = re.sub(re.sub(r'\\/' if sys.version_info[0] < 3 else r'/',
8484
slashes_re, re.escape(pattern)),
85-
replacement,
86-
stdin)
85+
replacement, stdin)
8786

8887
if args.dry_run:
8988
print(stdin)

0 commit comments

Comments
 (0)