1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-28 01:07:08 -05:00

Suppress syntax warnings on Python 3.12.

Python 3.12 has a new warning for backslash-character pairs that are not
valid escape sequences at the level of string literals, as opposed to in
some interior syntax such as regular expressions
(https://docs.python.org/3/whatsnew/3.12.html#other-language-changes).
Suppress it by using raw strings.
This commit is contained in:
Colin Watson 2024-08-01 15:18:57 +01:00 committed by Simon Tatham
parent 400c895ced
commit 22f8122b13
2 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ def winmungestr(s):
candot = 0
r = ""
for c in s:
if c in ' \*?%~' or ord(c)<ord(' ') or (c == '.' and not candot):
if c in r' \*?%~' or ord(c)<ord(' ') or (c == '.' and not candot):
r = r + ("%%%02X" % ord(c))
else:
r = r + c
@ -385,7 +385,7 @@ class OutputFormatter(object):
class WindowsOutputFormatter(OutputFormatter):
def header(self):
# Output REG file header.
self.fh.write("""REGEDIT4
self.fh.write(r"""REGEDIT4
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
""")

View File

@ -308,8 +308,8 @@ def _lex_testcrypt_header(header):
# And then match a token
'({})'.format('|'.join((
# Punctuation
'\(',
'\)',
r'\(',
r'\)',
',',
# Identifier
'[A-Za-z_][A-Za-z0-9_]*',