Skip to content

Commit f49014a

Browse files
Fix: flags in compiled regex
1 parent 21ab53a commit f49014a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/urllib/parse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
_UNSAFE_URL_BYTES_TO_REMOVE = ['\t', '\r', '\n']
9393

9494
# Zone ID regex as defined in RFC 6874
95-
zone_id_regex = re.compile(r"(%[a-fA-F0-9]{2}|[\w\.~-])+")
95+
zone_id_regex = re.compile(r"(%[a-fA-F0-9]{2}|[\w\.~-])+", flags=re.ASCII)
9696

9797
def clear_cache():
9898
"""Clear internal performance caches. Undocumented; some tests want it."""
@@ -469,7 +469,7 @@ def _check_bracketed_host(hostname):
469469
ip = ipaddress.ip_address(hostname) # Throws Value Error if not IPv6 or IPv4
470470
if isinstance(ip, ipaddress.IPv4Address):
471471
raise ValueError("An IPv4 address cannot be in brackets")
472-
if "%" in hostname and not zone_id_regex.fullmatch(hostname.split("%", 1)[1], flags=re.ASCII):
472+
if "%" in hostname and not zone_id_regex.fullmatch(hostname.split("%", 1)[1]):
473473
raise ValueError("IPv6 ZoneID is invalid")
474474

475475
# typed=True avoids BytesWarnings being emitted during cache key

0 commit comments

Comments
 (0)