[issue27860] Improvements to ipaddress module

Inada Naoki report at bugs.python.org
Mon Apr 15 06:59:18 EDT 2019


Inada Naoki <songofacandy at gmail.com> added the comment:

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.
https://github.com/python/cpython/blob/3c7931e514faf509a39c218c2c9f55efb434628f/Lib/test/test_ipaddress.py#L422-L440

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.

----------
versions: +Python 3.8 -Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27860>
_______________________________________


More information about the Python-bugs-list mailing list