# HG changeset patch # User Goffi # Date 1631092487 -7200 # Node ID cc3b453670a2c0681b7e6cc329a1660dc030fc9f # Parent 0ffaa231138c42fe3f03594dc73e970d8516c98e tools (common/uri): fix uri parsing for Python 3.9+ diff -r 0ffaa231138c -r cc3b453670a2 sat/tools/common/uri.py --- a/sat/tools/common/uri.py Wed Sep 08 11:14:17 2021 +0200 +++ b/sat/tools/common/uri.py Wed Sep 08 11:14:47 2021 +0200 @@ -19,6 +19,7 @@ """ XMPP uri parsing tools """ +import sys import urllib.parse import urllib.request, urllib.parse, urllib.error @@ -53,7 +54,13 @@ if query_end == -1 or "=" in query_type: raise ValueError("no query type, invalid XMPP URI") - pairs = urllib.parse.parse_qs(uri_split.geturl()) + if sys.version_info >= (3, 9): + # parse_qs behaviour has been modified in Python 3.9, ";" is not understood as a + # parameter separator anymore but the "separator" argument has been added to + # change it. + pairs = urllib.parse.parse_qs(uri_split.geturl(), separator=";") + else: + pairs = urllib.parse.parse_qs(uri_split.geturl()) for k, v in list(pairs.items()): if len(v) != 1: raise NotImplementedError("multiple values not managed")