Skip to content

Commit 278f73a

Browse files
committed
Fix "SyntaxWarning: invalid escape sequence"
The "SyntaxWarning: invalid escape sequence" warning first appeared in Python 3.12, which enforces stricter rules for unescaped regular expressions. Use an r-string instead, as this was always the correct approach.
1 parent d49cea0 commit 278f73a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

make-tag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def parse_tag(tag):
3838
- v1.2rc3
3939
- v1.2.3rc4
4040
'''
41-
m = re.match("^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:rc([0-9])+)?$", tag)
41+
m = re.match(r"^v([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:rc([0-9])+)?$", tag)
4242

4343
if m is None:
4444
print(f"Invalid tag {tag}", file=sys.stderr)
@@ -71,7 +71,7 @@ def check_configure_ac(spec):
7171
filename = 'configure.ac'
7272
with open(filename) as f:
7373
for line in f:
74-
m = re.match("define\(_CLIENT_VERSION_([A-Z_]+), ([0-9a-z]+)\)", line)
74+
m = re.match(r"define\(_CLIENT_VERSION_([A-Z_]+), ([0-9a-z]+)\)", line)
7575
if m:
7676
info[m.group(1)] = m.group(2)
7777
# check if IS_RELEASE is set

0 commit comments

Comments
 (0)