Use raw strings for regexs containing escapes

In Python 3.12, these invalid escape sequences emit SyntaxWarnings, and will
emit SyntaxErrors in a future release.

Found using: grep '[^r]["'\''].*\\[^rn\\x0t"]' $(grep -rl '^#!.*python')
This commit is contained in:
Alex Xu (Hello71)
2023-12-09 10:16:08 -05:00
parent 82e73df8f7
commit 9f731ac68c
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -144,7 +144,7 @@ sslProto = open(ff('security/nss/lib/ssl/sslproto.h'), 'r')
sslProtoD = {}
for line in sslProto:
m = re.match('#define\s+(\S+)\s+(\S+)', line)
m = re.match(r'#define\s+(\S+)\s+(\S+)', line)
if m:
key, value = m.groups()
sslProtoD[key] = value
@@ -165,7 +165,7 @@ for fl in oSSLinclude:
continue
fp = open(fname, 'r')
for line in fp.readlines():
m = re.match('# *define\s+(\S+)\s+(\S+)', line)
m = re.match(r'# *define\s+(\S+)\s+(\S+)', line)
if m:
value,key = m.groups()
if key.startswith('0x') and "_CK_" in value: