From: Petr Písař Date: Mon, 24 Jul 2023 08:57:49 +0000 (+0200) Subject: Fix string escaping in location tool X-Git-Tag: 0.9.17~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=42377dbd26c946cf0df3402ca197290608e0bc22;p=location%2Flibloc.git Fix string escaping in location tool Python 3.12 started to warn on an invalid string escape sequence: $ location list-networks-by-as --format ipset 1 /usr/bin/location:583: SyntaxWarning: invalid escape sequence '\d' m = re.match("^AS(\d+)$", object) IpsetOutputWriter requires family being set This patch fixes the warning as well as the regular expression by using a raw string. Fixes: #13188 - Invalid escape sequence with Python 3.12 Signed-off-by: Petr Písař Signed-off-by: Michael Tremer --- diff --git a/src/scripts/location.in b/src/scripts/location.in index 60b11d6..b34cc91 100644 --- a/src/scripts/location.in +++ b/src/scripts/location.in @@ -580,7 +580,7 @@ class CLI(object): families = [ socket.AF_INET6, socket.AF_INET ] for object in ns.objects: - m = re.match("^AS(\d+)$", object) + m = re.match(r"^AS(\d+)$", object) if m: object = int(m.group(1))