mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)
Automerge-Triggered-By: @tiran
This commit is contained in:
parent
1d541c25c8
commit
fabd7bb8e0
12 changed files with 36 additions and 36 deletions
|
@ -1214,7 +1214,7 @@ class _BaseV4:
|
|||
"""
|
||||
if not octet_str:
|
||||
raise ValueError("Empty octet not permitted")
|
||||
# Whitelist the characters, since int() allows a lot of bizarre stuff.
|
||||
# Reject non-ASCII digits.
|
||||
if not (octet_str.isascii() and octet_str.isdigit()):
|
||||
msg = "Only decimal digits permitted in %r"
|
||||
raise ValueError(msg % octet_str)
|
||||
|
@ -1719,7 +1719,7 @@ class _BaseV6:
|
|||
[0..FFFF].
|
||||
|
||||
"""
|
||||
# Whitelist the characters, since int() allows a lot of bizarre stuff.
|
||||
# Reject non-ASCII digits.
|
||||
if not cls._HEX_DIGITS.issuperset(hextet_str):
|
||||
raise ValueError("Only hex digits permitted in %r" % hextet_str)
|
||||
# We do the length check second, since the invalid character error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue