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.
<https://docs.python.org/3.12/whatsnew/changelog.html#id77>
Fixes: #13188 - Invalid escape sequence with Python 3.12
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
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))