-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Similar to https://tahoe-lafs.org/trac/tahoe-lafs/ticket/4158 and tahoe-lafs/tahoe-lafs#1427:
From https://stackoverflow.com/a/77531416/1181063:
Back in Python 3.6, using invalid escape sequences in string literals was deprecated (bpo-27364). Since then, attempting to use an invalid escape sequence has emitted a DeprecationWarning. This can often go unnoticed if you don't run Python with warnings enabled. DeprecationWarnings are silenced by default.
Python 3.12 upgraded the DeprecationWarning to a SyntaxWarning. SyntaxWarnings are emitted by the compiler when the code is parsed, not when it's being run, so they cannot be ignored using a runtime warning filter. Unlike DeprecationWarnings, SyntaxWarnings are displayed by default, which is why you're seeing it now. This increase in visibility was intentional. In a future version of Python, using invalid escape sequences in string literals is planned to eventually become a hard SyntaxError.
From the Tahoe-LAFS CI job for the Debian Trixie package:
Setting up python3-pyutil (3.3.2-3) ...
/usr/lib/python3/dist-packages/pyutil/iputil.py:180: SyntaxWarning: invalid escape sequence '\s'
_win32_re = re.compile('^\s*\d+\.\d+\.\d+\.\d+\s.+\s(?P<address>\d+\.\d+\.\d+\.\d+)\s+(?P<metric>\d+)\s*$', flags=re.M|re.I|re.S)
/usr/lib/python3/dist-packages/pyutil/iputil.py:184: SyntaxWarning: invalid escape sequence '\s'
_linux_re = re.compile('^\s*inet [a-zA-Z]*:?(?P<address>\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S)
/usr/lib/python3/dist-packages/pyutil/iputil.py:189: SyntaxWarning: invalid escape sequence '\s'
_netbsd_re = re.compile('^\s+inet [a-zA-Z]*:?(?P<address>\d+\.\d+\.\d+\.\d+)\s.+$', flags=re.M|re.I|re.S)
/usr/lib/python3/dist-packages/pyutil/platformutil.py:6: SyntaxWarning: invalid escape sequence '\s'
_distributor_id_cmdline_re = re.compile("(?:Distributor ID:)\s*(.*)", re.I)
/usr/lib/python3/dist-packages/pyutil/platformutil.py:7: SyntaxWarning: invalid escape sequence '\s'
_release_cmdline_re = re.compile("(?:Release:)\s*(.*)", re.I)
/usr/lib/python3/dist-packages/pyutil/platformutil.py:9: SyntaxWarning: invalid escape sequence '\s'
_distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
/usr/lib/python3/dist-packages/pyutil/platformutil.py:10: SyntaxWarning: invalid escape sequence '\s'
_release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
/usr/lib/python3/dist-packages/pyutil/test/current/test_iputil.py:18: SyntaxWarning: invalid escape sequence '\.'
DOTTED_QUAD_RE=re.compile("^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$")
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:82: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(any(x for x in d.values() if x is 8))
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:84: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(not any(x for x in d.values() if x is 7)) # The real 7 should have been ejected by the d[3] = 8.
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:86: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(any(x for x in d if x is 3))
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:95: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(any(x for x in d.values() if x is 8))
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:97: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(not any(x for x in d.values() if x is 7)) # The real 7 should have been ejected by the d[3] = 8.
/usr/lib/python3/dist-packages/pyutil/test/deprecated/test_dictutil.py:99: SyntaxWarning: "is" with 'int' literal. Did you mean "=="?
_assert(any(x for x in d if x is 3))
/usr/lib/python3/dist-packages/pyutil/version_class.py:82: SyntaxWarning: invalid escape sequence '\d'
VERSION_BASE_RE_STR="(\d+)(\.(\d+)(\.(\d+))?)?((a|b|c)(\d+))?(\.dev(\d+))?"
/usr/lib/python3/dist-packages/pyutil/version_class.py:83: SyntaxWarning: invalid escape sequence '\d'
VERSION_SUFFIX_RE_STR="(-(\d+|r\d+)|.post\d+)?"