Open d75465a0-03f0-400b-be73-3acf509a5c12 opened 5 years ago
ip = '23.00.021.002'
ipaddress.IPv4Address(ip)
throw error:
File "/usr/lib/python3.4/ipaddress.py", line 1271, in __init__
self._ip = self._ip_int_from_string(addr_str)
File "/usr/lib/python3.4/ipaddress.py", line 1122, in _ip_int_from_string
raise AddressValueError("%s in %r" % (exc, ip_str)) from None
ipaddress.AddressValueError: Ambiguous (octal/decimal) value in '021' not permitted in '23.00.021.002'
ip = '23.00.21.002'
ipaddress.IPv4Address(ip)
parses correctly.
From the documentation of IPv4Address:
The following constitutes a valid IPv4 address:
21 is not less than 8, so you get this error. I think this is working as it's documented.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['type-bug', 'library']
title = 'Inconsistent behavior when parsing IP address'
updated_at =
user = 'https://github.com/tinutomson'
```
bugs.python.org fields:
```python
activity =
actor = 'eric.smith'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'tinutomson'
dependencies = []
files = []
hgrepos = []
issue_num = 35820
keywords = []
message_count = 2.0
messages = ['334319', '334323']
nosy_count = 2.0
nosy_names = ['eric.smith', 'tinutomson']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue35820'
versions = []
```