diff options
author | Joel Croteau <jcroteau@gmail.com> | 2019-03-30 14:53:48 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2019-03-30 14:53:48 (GMT) |
commit | e653d4d8e820a7a004ad399530af0135b45db27a (patch) | |
tree | 140ff14e2dccd2daf4a7e7b28a6db743f6347c6d /Lib/ipaddress.py | |
parent | ddbb978e1065dde21d1662386b26ded359f4b16e (diff) | |
download | cpython-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.py | 6 |
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 |