[New-bugs-announce] [issue27860] Improvements to ipaddress module

Moritz Sichert report at bugs.python.org
Thu Aug 25 11:14:28 EDT 2016


New submission from Moritz Sichert:

This patch fixes the following minor issues with the ipaddress module:

- Removed unused property _BaseV4._valid_mask_octets
- Removed unused methods _BaseV4._is_valid_netmask() and _BaseV4._is_hostmask()
- Replaced several calls to superclass constructors by super()

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 issue 27683.

----------
components: Library (Lib)
files: ipaddress-improvement.patch
keywords: patch
messages: 273655
nosy: moritzs
priority: normal
severity: normal
status: open
title: Improvements to ipaddress module
type: enhancement
versions: Python 3.6
Added file: https://bugs.python.org/file44223/ipaddress-improvement.patch

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


More information about the New-bugs-announce mailing list