Skip to content

Commit 5148f0b

Browse files
authored
utils/compare.py: Fix syntax warning on python 3.12 (#96)
As of Python 3.12 there's now a syntax warning for invalid escape sequences: ./utils/compare.py:195: SyntaxWarning: invalid escape sequence '\g' This fixes it by using a raw string literal, as recommended here: https://docs.python.org/3/library/re.html
1 parent b2c5007 commit 5148f0b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

utils/compare.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def print_filter_stats(reason, before, after):
192192
# in the middle
193193
def truncate(string, prefix_len, suffix_len):
194194
return re.sub(
195-
"^(.{%d}).*(.{%d})$" % (prefix_len, suffix_len), "\g<1>...\g<2>", string
195+
"^(.{%d}).*(.{%d})$" % (prefix_len, suffix_len), r"\g<1>...\g<2>", string
196196
)
197197

198198

0 commit comments

Comments
 (0)