[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask

2014-11-05 Thread Chris PeBenito

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 "", line 1, in 
  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 
<http://bugs.python.org/issue22800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask

2014-11-08 Thread Chris PeBenito

Chris PeBenito added the comment:

That's unfortunate. The library provides factory functions so v4 and v6 
addresses/networks are easily handled together, and yet it seems to have been 
overlooked that you can do this:

ipaddress.ip_network('192.168.1.0/255.255.255.0') 

but not this:

ipaddress.ip_network('ff00::/ff00::')

I'll open up another issue for the docs, as they are not simply unhelpful, 
they're misleading, as the IPv6Network docs clearly say that you should be able 
to use an expanded netmask.

--

___
Python tracker 
<http://bugs.python.org/issue22800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22822] IPv6Network constructor docs incorrect about valid input

2014-11-08 Thread Chris PeBenito

New submission from Chris PeBenito:

Here:

https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv6Network

In the constructor documentation, item 1 says:

"""
A string consisting of an IP address and an optional mask, separated by a slash 
(/). The IP address is the network address, and the mask can be either a single 
number, which means it’s a prefix, or a string representation of an IPv6 
address. If it’s the latter, the mask is interpreted as a net mask. If no mask 
is provided, it’s considered to be /128.

For example, the following address specifications are equivalent: 
2001:db00::0/24 and 2001:db00::0/:ff00::.
"""

However in issue22800 it has been identified that using the expanded netmask 
(e.g. ff00::/ff00::) is not supported.

--
assignee: docs@python
components: Documentation
messages: 230871
nosy: docs@python, pebenito
priority: normal
severity: normal
status: open
title: IPv6Network constructor docs incorrect about valid input
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 
<http://bugs.python.org/issue22822>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22800] IPv6Network constructor sometimes does not recognize legitimate netmask

2014-11-10 Thread Chris PeBenito

Chris PeBenito added the comment:

I understand the resistance; I'm fine closing this as "won't implement", though 
this is not for academic use.  In a nutshell, my package currently has a set of 
classes to represent an SELinux policy, and the SELinux policy language 
represents networks with extended netmask[1].  I control the package, so I can 
change the internal representation from extended netmask to CIDR, so it's not 
the end of the world.

[1] example statement: nodecon ff00:: ff00:: system_u:object_r:multicast_node_t

--

___
Python tracker 
<http://bugs.python.org/issue22800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com