Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipaddress ver. 1.0.14 IPv4Network off by 1 #74592

Closed
khiraiongakuisa-geeknet mannequin opened this issue May 19, 2017 · 5 comments
Closed

ipaddress ver. 1.0.14 IPv4Network off by 1 #74592

khiraiongakuisa-geeknet mannequin opened this issue May 19, 2017 · 5 comments

Comments

@khiraiongakuisa-geeknet
Copy link
Mannequin

BPO 30407
Nosy @zhangyangyu, @khirai@ongaku.isa-geek.net

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:

assignee = None
closed_at = <Date 2017-05-20.02:02:34.745>
created_at = <Date 2017-05-19.21:34:42.874>
labels = ['invalid']
title = 'ipaddress ver. 1.0.14 IPv4Network off by 1'
updated_at = <Date 2017-05-24.05:08:08.942>
user = 'https://github.com/khiraiongakuisa-geeknet'

bugs.python.org fields:

activity = <Date 2017-05-24.05:08:08.942>
actor = 'xiang.zhang'
assignee = 'none'
closed = True
closed_date = <Date 2017-05-20.02:02:34.745>
closer = 'xiang.zhang'
components = []
creation = <Date 2017-05-19.21:34:42.874>
creator = 'kghongaku'
dependencies = []
files = []
hgrepos = []
issue_num = 30407
keywords = []
message_count = 5.0
messages = ['293978', '293980', '293991', '294254', '294321']
nosy_count = 2.0
nosy_names = ['xiang.zhang', 'kghongaku']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue30407'
versions = ['Python 2.7']

@khiraiongakuisa-geeknet
Copy link
Mannequin Author

for x in ipaddress.IPv4Network(u"192.168.0.0/23").hosts():
    print x

contains 192.168.1.0 but does not contain 192.168.1.255

ipaddress version 1.0.14

@khiraiongakuisa-geeknet
Copy link
Mannequin Author

tested with 1.0.18 with same results.

@zhangyangyu
Copy link
Member

See the doc: https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Network.hosts. For hosts() method, network address and broadcast address are excluded from the result. So it's right IPv4Address('192.168.0.0') and IPv4Address('192.168.1.255') are not included.

@khiraiongakuisa-geeknet
Copy link
Mannequin Author

i thought it was inconsistent that
192.168.1.0 was included, but 192.168.0.0 was not.

@zhangyangyu
Copy link
Member

"192.168.0.0" is the network address of "192.168.0.0/23" while "192.168.1.0" not. :-)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant