[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask

Chris PeBenito report at bugs.python.org
Wed Nov 5 16:34:45 CET 2014


New submission from Chris PeBenito:

Python 3.3/3.4 sometimes does not recognize a legitimate IPv6Network netmask:

$ python3
Python 3.3.5 (default, May 28 2014, 13:56:57) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipaddress as ip
>>> nodecon = ip.IPv6Network('ff00::/ff00::')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.3/ipaddress.py", line 2084, in __init__
    self._prefixlen = self._prefix_from_prefix_string(addr[1])
  File "/usr/lib64/python3.3/ipaddress.py", line 514, in _prefix_from_prefix_string
    self._report_invalid_netmask(prefixlen_str)
  File "/usr/lib64/python3.3/ipaddress.py", line 497, in _report_invalid_netmask
    raise NetmaskValueError(msg) from None
ipaddress.NetmaskValueError: 'ff00::' is not a valid netmask
>>> nodecon = ip.IPv6Network('ff00::/8')
>>> print(nodecon)
ff00::/8
>>> print(nodecon.with_netmask)
ff00::/ff00::

I get the same behavior on Python 3.4.2.

----------
components: Library (Lib)
messages: 230686
nosy: pebenito
priority: normal
severity: normal
status: open
title: IPv6Network constructor sometimes does not recognize legitimate netmask
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22800>
_______________________________________


More information about the Python-bugs-list mailing list