This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove unused _BaseV4._is_valid_netmask in ipaddress
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: lin.lin, methane, pmoody, remi.lapeyre, xtreak
Priority: normal Keywords: patch, patch, patch

Created on 2019-01-14 03:51 by lin.lin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_ipaddress.py lin.lin, 2019-01-14 03:51 The validatation of the Bug
Pull Requests
URL Status Linked Edit
PR 11591 merged remi.lapeyre, 2019-01-17 13:36
PR 11591 merged remi.lapeyre, 2019-01-17 13:36
PR 11591 merged remi.lapeyre, 2019-01-17 13:36
Messages (9)
msg333581 - (view) Author: ulin (lin.lin) * Date: 2019-01-14 03:51
valid netmask like 255.0.0.0 255.128.0.0, but 255.254.128.0 is not valid, but ipaddress._BaseV4._is_valid_netmask fails to detect the latter.

Tested in Python 3.6.7, as the code stays the same, affects all after Python 3.6.7.
msg333611 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-01-14 11:40
I couldn't find any use of _is_valid_netmask() in the code, why should this netmask be invalid?

As far as I can tell this should be a valid one, is there a reason to refuse it?
msg333612 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-01-14 11:54
> I couldn't find any use of _is_valid_netmask() in the code, why should this netmask be invalid?

There is an open issue to remove this method which is unused and undocumented issue27860. 

I have less knowledge on the subnet masking area but on searching the web there seems to be an RFC that asks for contiguous ones without intermixing zeroes that I hope OP is referring to.

* https://superuser.com/questions/601252/is-225-225-225-128-a-valid-subnet-mask
* https://superuser.com/questions/1151908/non-contiguous-subnet-mask/1151942#1151942
msg333616 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-01-14 13:02
Still 255.254.128.0 is a valid subnet.

If I understand correctly, rfc1519 relate to how public ip addresses should be attributed. It does not cover what private subnets you use and you still can such submask (as long as you own the whole /16 for example).

rfc950 explicitly allow for such subnets:

> Since the bits that identify the subnet are specified by a bitmask, they need not be adjacent in the address. However, we recommend that the subnet bits be contiguous and located as the most significant bits of the local address.

and I've heard of them being used (hence the complications and the need for rfc1519 for the public address space).

I'm in favor of closing this issue in favor of issue27860.
msg333867 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-01-17 13:40
I opened https://github.com/python/cpython/pull/11591 to remove _valid_mask_octets, _is_valid_netmask and _is_hostmask from ipaddress, the patch proposed in issue27860 has a larger scope so it's probably better to remove those unused methods in this issue.

Does someone know how to set the skip news label on GitHub?
msg333869 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-01-17 14:07
> I opened https://github.com/python/cpython/pull/11591 to remove _valid_mask_octets, _is_valid_netmask and _is_hostmask from ipaddress, the patch proposed in issue27860 has a larger scope so it's probably better to remove those unused methods in this issue.

Thanks, the subject of the issue is misleading and I would propose changing the issue subject or closing this in favor of the other issue and opening a PR against issue27860 stating that this only removes the unused functions and not the complete patch attached. This would require a review from the module maintainer I hope though it's an internal function that is never used.

> Does someone know how to set the skip news label on GitHub?

It needs to be added by a core dev
msg333885 - (view) Author: Rémi Lapeyre (remi.lapeyre) * Date: 2019-01-17 15:38
I changed the subject of this issue as the scope of issue27860 is larger. I will review them and open a new PR for them if appropriate once this one is accepted.
msg333937 - (view) Author: ulin (lin.lin) * Date: 2019-01-18 03:49
OK, message copied, I'll mark it closed. :)
msg340148 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-04-13 08:49
New changeset e59ec1b05d3e1487ca7754530d3748446c9b7dfd by Inada Naoki (Rémi Lapeyre) in branch 'master':
bpo-35734: ipaddress: remove unused methods (GH-11591)
https://github.com/python/cpython/commit/e59ec1b05d3e1487ca7754530d3748446c9b7dfd
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 79915
2019-04-13 08:49:56methanesetnosy: + methane
messages: + msg340148
2019-01-18 03:49:43lin.linsetstatus: open -> closed
resolution: not a bug
messages: + msg333937

stage: patch review -> resolved
2019-01-17 15:38:10remi.lapeyresetmessages: + msg333885
title: ipaddress's _BaseV4._is_valid_netmask fails to detect invalid netmask like 255.254.128.0 -> Remove unused _BaseV4._is_valid_netmask in ipaddress
2019-01-17 14:07:25xtreaksetkeywords: patch, patch, patch

messages: + msg333869
2019-01-17 13:40:57remi.lapeyresetmessages: + msg333867
2019-01-17 13:36:25remi.lapeyresetkeywords: + patch
stage: patch review
pull_requests: + pull_request11288
2019-01-17 13:36:20remi.lapeyresetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11287
2019-01-17 13:36:14remi.lapeyresetkeywords: + patch
stage: (no value)
pull_requests: + pull_request11286
2019-01-14 13:02:05remi.lapeyresetmessages: + msg333616
2019-01-14 11:54:42xtreaksetmessages: + msg333612
2019-01-14 11:40:53remi.lapeyresetnosy: + remi.lapeyre
messages: + msg333611
2019-01-14 06:10:28xtreaksetnosy: + pmoody
2019-01-14 04:55:20xtreaksetnosy: + xtreak
2019-01-14 03:51:18lin.lincreate