Package: python3-whois
Version: 0.8-1
Severity: minor
Tags: patch
X-Debbugs-Cc:
dev@shallowsky.com
Dear Maintainer,
Running anything that imports whois gives six lines of warnings:
/usr/lib/python3/dist-packages/whois/_3_adjust.py:77: SyntaxWarning: invalid escape sequence '\+'
s = re.sub('(\+[0-9]{2}):([0-9]{2})', '\\1\\2', s) /usr/lib/python3/dist-packages/whois/_3_adjust.py:78: SyntaxWarning: invalid escape sequence '\ '
s = re.sub('(\ #.*)', '', s) /usr/lib/python3/dist-packages/whois/_3_adjust.py:92: SyntaxWarning: invalid escape sequence '\+'
tmp = re.findall('\+([0-9]{2})00', s)
This is because since Python 3.12, Python complains about strings that have things like backslashes in them that aren't string escapes.
The fix is very easy, just put r in front of each string, e.g.
s = re.sub(r'(\+[0-9]{2}):([0-9]{2})', '\\1\\2', s)
Here's a patch that does that for the three lines that are printing warnings:
========= Begin patch
--- /usr/lib/python3/dist-packages/whois/_3_adjust.py 2019-05-13 16:08:01.000000000 -0600
+++ /tmp/_3_adjust.py 2025-05-27 12:30:38.067301104 -0600
@@ -74,8 +74,8 @@
return
s = s.replace('(jst)', '(+0900)')
- s = re.sub('(\+[0-9]{2}):([0-9]{2})', '\\1\\2', s)
- s = re.sub('(\ #.*)', '', s)
+ s = re.sub(r'(\+[0-9]{2}):([0-9]{2})', '\\1\\2', s)
+ s = re.sub(r'(\ #.*)', '', s)
if PYTHON_VERSION < 3: return str_to_date_py2(s)
@@ -89,7 +89,7 @@
def str_to_date_py2(s):
- tmp = re.findall('\+([0-9]{2})00', s)
+ tmp = re.findall(r'\+([0-9]{2})00', s)
if tmp:
tz = int(tmp[0])
else:
========= End patch
-- System Information:
Debian Release: 13.0
APT prefers unstable
APT policy: (600, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.29-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via