[issue20857] ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug

R. David Murray report at bugs.python.org
Thu Mar 6 17:20:35 CET 2014


New submission from R. David Murray:

The 'is_private' and 'is_global' properties refer to the iana registries, but the terms 'private network' and 'public network' do no appear in the registry documentation.  There is no way to know what these methods are going to return other than examining the source code.

In particular, without looking at the source code a best-guess interpretation of the documentation would lead one to expect that is_private would return true only for RFC1918 addresses, since that is the one place the term 'private' appears.  Similarly, the naive interpretation of is_global would be that it would return False for all addresses listed in the ipv4 registry *except* 192.88.99.0/24, which is the only one whose global routing flag is True in the table.

I would submit that the fact that the latter is not true is a bug.

It is really not at all clear what 'is_private' means (see also issue 17400, which introduced is_global), so I am completely unclear how to rewrite the documentation to fully specify it, other than to list out the address ranges that it considers private.

----------
messages: 212812
nosy: ncoghlan, pmoody, r.david.murray
priority: normal
severity: normal
status: open
title: ipaddress "is_private" and "is_global" are insufficiently documented and is_global probably has a bug
type: behavior
versions: Python 3.4, Python 3.5

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


More information about the Python-bugs-list mailing list