summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorJoel Croteau <jcroteau@gmail.com>2019-03-30 14:53:48 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2019-03-30 14:53:48 (GMT)
commite653d4d8e820a7a004ad399530af0135b45db27a (patch)
tree140ff14e2dccd2daf4a7e7b28a6db743f6347c6d /Lib/ipaddress.py
parentddbb978e1065dde21d1662386b26ded359f4b16e (diff)
downloadcpython-e653d4d8e820a7a004ad399530af0135b45db27a.zip
cpython-e653d4d8e820a7a004ad399530af0135b45db27a.tar.gz
cpython-e653d4d8e820a7a004ad399530af0135b45db27a.tar.bz2
bpo-36384: Remove check for leading zeroes in IPv4 addresses (GH-12577)
Stop rejecting IPv4 octets with leading zeroes as ambiguously octal. Plenty of other tools generate decimal IPv4 octets with leading zeroes, so keeping this check hurts interoperability. Patch by Joel Croteau.
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py6
1 files changed, 0 insertions, 6 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 15507d6..a88cf3d 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1165,12 +1165,6 @@ class _BaseV4:
raise ValueError(msg % octet_str)
# Convert to integer (we know digits are legal)
octet_int = int(octet_str, 10)
- # Any octets that look like they *might* be written in octal,
- # and which don't look exactly the same in both octal and
- # decimal are rejected as ambiguous
- if octet_int > 7 and octet_str[0] == '0':
- msg = "Ambiguous (octal/decimal) value in %r not permitted"
- raise ValueError(msg % octet_str)
if octet_int > 255:
raise ValueError("Octet %d (> 255) not permitted" % octet_int)
return octet_int