Repository navigation
Closed
Labels
3.7 (EOL)end of life3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
Description
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 2019-06-19.11:48:12.761>
created_at = <Date 2016-08-25.15:14:28.605>
labels = ['3.7', '3.8', 'type-feature', 'library']
title = 'Improvements to ipaddress module'
updated_at = <Date 2019-06-19.11:48:12.760>
user = 'https://bugs.python.org/moritzs'bugs.python.org fields:
activity = <Date 2019-06-19.11:48:12.760>
actor = 'methane'
assignee = 'none'
closed = True
closed_date = <Date 2019-06-19.11:48:12.761>
closer = 'methane'
components = ['Library (Lib)']
creation = <Date 2016-08-25.15:14:28.605>
creator = 'moritzs'
dependencies = []
files = ['44223']
hgrepos = []
issue_num = 27860
keywords = ['patch']
message_count = 13.0
messages = ['273655', '279600', '279607', '339845', '340240', '340259', '340307', '340308', '343349', '343537', '343671', '345983', '346038']
nosy_count = 8.0
nosy_names = ['ncoghlan', 'pmoody', 'methane', 'SilentGhost', 'serhiy.storchaka', 'moritzs', 'xiang.zhang', 'Jacktose']
pr_nums = ['12774', '12832', '12836', '14200']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue27860'
versions = ['Python 3.7', 'Python 3.8']Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of life3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement
Activity
MoritzS commentedon Aug 25, 2016
This patch fixes the following minor issues with the ipaddress module:
It also refactors the constructors of IPv4Network, IPv4Interface, IPv6Network, and IPv6Interface.
They all now use the new method _get_addr_prefix_tuple() to parse the argument. It now matches the following sentence of the documentation of IPv4/6Interface:
"The meaning of address is as in the constructor of IPv4Network".
Additionally they now also accept a bytes or an IPv4/6Address object representing a netmask (or a hostmask [only IPv4]) as second element of an address/netmask tuple. This makes it easier to work with C-APIs that provide netmasks only as bytes object.
This patch does not try to solve bpo-27683.
MoritzS commentedon Oct 28, 2016
Any updates?
ncoghlan commentedon Oct 28, 2016
Peter, are you able to take a look at this or indicate you're happy for someone else to take it? (I relinquished my co-maintainer role for the ipaddress module a while back, so you're the only currently listed maintainer)
methane commentedon Apr 10, 2019
@MoritzS Would you create a pull request on GitHub?
Or may I create a pull request for your patch?
methane commentedon Apr 15, 2019
New changeset 2430d53 by Inada Naoki in branch 'master':
bpo-27860: use cached_property (GH-12832)
2430d53
methane commentedon Apr 15, 2019
I am not owner of ipaddress module, so I don't know we should
support more form of masks.
On the other hand, IPv4Interface and IPv6Interface expose
netmask and hostmask attributes when address is not bytes or int.
These attributes are not documented. I assume it was added
accidentally, when coping some code from Network classes.
But there are test for these attributes.
NetmaskTestMixin_v4.test_valid_netmask runs for IPv4Network and IPv4Interface.
It checks these attributes when constructor argument is string.
cpython/Lib/test/test_ipaddress.py
Lines 422 to 440 in 3c7931e
For safety, I added these attributes always, instead of remove them.
PR-12836 is fixing it, and extracts methods for Network/Interface constructor
(a part of PR-12774). It doesn't add additional mask form support.
methane commentedon Apr 15, 2019
New changeset 6fa84bd by Inada Naoki in branch 'master':
bpo-27860: ipaddress: fix Interface missed some attributes (GH-12836)
6fa84bd
methane commentedon Apr 15, 2019
I merged all cleanups.
I don't merge accepting any IP representations as mask, because I'm not expert of this module.
At least, I don't want to pass prefix/netmask by something like IPv4Network("0.0.255.255").
SilentGhost commentedon May 24, 2019
I was wondering why it was decided against backporting to 3.7? 6fa84bd fixes an actual bug bpo-35990 (string mask in tuple argument for IPv4Interfaces). Incidentally, there are also no tests for this behaviour.
Just to note: both merged PRs lacked news entry.
methane commentedon May 26, 2019
Because I treats this is just a code cleanup.
I didn't thought it was a bug.
I don't know it is real bug which should be backported to 3.7 for now.
Because I thought there are no change about public (documented) behavior.
NEWS entry is not needed for code cleanup.
jacktose commentedon May 27, 2019
I for one have encountered bpo-35990 in my work and would appreciate a backport.
methane commentedon Jun 18, 2019
OK, I thought I improved only undocumented behavior, but it was documented and previous behavior didn't follow the document.
I'll backport PR 12836.
methane commentedon Jun 19, 2019
New changeset f532fe5 by Inada Naoki in branch '3.7':
bpo-27860: ipaddress: fix Interface constructor (GH-14200)
f532fe5