[New-bugs-announce] [issue28577] ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32
era
report at bugs.python.org
Tue Nov 1 03:02:04 EDT 2016
New submission from era:
I would expect the following code to return ['10.9.8.8'] but it returns an empty list.
yosemite-osx$ python3
Python 3.5.1 (default, Dec 26 2015, 18:08:53)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ipaddress
>>> list(ipaddress.ip_network('10.9.8.7/32').hosts())
[]
This seems to happen for every /32 address. I'm guessing the logic which wants to exclude the gateway and broadcast addresses from a block should treat a /32 as a special case.
I tried to look for a previous bug submission but I could not find one. As such, it seems peculiar if this has not been reported before. Is this actually expected behavior by some rule I am overlooking?
I tested on Linux 3.4 and OSX Yosemite Homebrew / Python 3.5.1.
----------
components: Library (Lib)
messages: 279855
nosy: era
priority: normal
severity: normal
status: open
title: ipaddress.ip_network(...).hosts() returns nothing for an IPv4 /32
versions: Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28577>
_______________________________________
More information about the New-bugs-announce
mailing list