[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2022-01-24 Thread Humbdrag


Change by Humbdrag :


--
keywords: +patch
nosy: +humbdrag
nosy_count: 5.0 -> 6.0
pull_requests: +29043
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/30862

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2018-03-01 Thread Xiang Zhang

Change by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-12-20 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Do you need any help with the change?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-10-27 Thread Ilya Kulakov

Ilya Kulakov  added the comment:

Can this be included into the next bugfix release?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-25 Thread Louie Lu

Louie Lu added the comment:

Add unittest. Since IPv6 do not support prefix netmask (':ff00::'), it have 
only test like this:

>>> a = ipaddress.ip_interface(('dead:beaf::', '32'))
>>> b = ipaddress.ip_interface('dead:beaf::/32')
>>> str(a) == str(b)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-25 Thread Eric V. Smith

Eric V. Smith added the comment:

Thanks! Yes, we'll need tests.

I'm out of town most of the weekend, but I'll look at this as soon as I can.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-25 Thread Louie Lu

Louie Lu added the comment:

Eric: I made the patch, reference to which IPv*Network dealing with tuple. 
Should I also add the unittest for it?

Also, can you help me code review this, thanks.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-25 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +722

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-25 Thread Eric V. Smith

Eric V. Smith added the comment:

While an IPv4Interface may be a subclass of an IPv4Address, it definitely has 
more information attached to it: the netmask of the network it's on. So an 
interface (like a network) needs to allow additional parameters to specify the 
netmask.

It should be true that IPv4Interface is like IPv4Network, but it will allow 
arbitrary host bits. A IPv4Network in strict mode will have all zeros for the 
host bits, while a IPv4Network in non-strict mode will allow ones in the host 
bits (see Ilya's original example).

If you look at IPv4Interface.__init__, it actually does just that: creates an 
IPv4Network with strict=False, then extracts the network parts. I'm not exactly 
sure why it also has the int(address[1]) code there, too, since IPvv4Network 
deals with the address[1] part. I would think extracting _prefixlen from the 
network (as it does later in __init__ for the non-tuple case) would be good 
enough.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-24 Thread Louie Lu

Louie Lu added the comment:

The document here says: 
https://docs.python.org/3/library/ipaddress.html#interface-objects

""IPv4Interface is a subclass of IPv4Address""

trying with:

>>> ipaddress.IPv4Address(('192.168.128.0', '255.255.255.0'))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/ipaddress.py", line 1284, in __init__
self._ip = self._ip_int_from_string(addr_str)
  File "/usr/lib/python3.6/ipaddress.py", line 1118, in _ip_int_from_string
raise AddressValueError("Expected 4 octets in %r" % ip_str)
ipaddress.AddressValueError: Expected 4 octets in "('192.168.128.0', 
'255.255.255.0')"

So the behavior of IPv4Interface seem to be correct?

--
nosy: +louielu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-24 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +pmoody

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-23 Thread Eric V. Smith

Eric V. Smith added the comment:

This should be easy enough to fix, at least in IPv4Interface.__init__. It needs 
to copy some of IPv4Network.__init__, dealing with address[1] and calling 
_make_netmask(). Currently, it just calls int(address[1]).

I haven't looked at IPv6Interface.

Tests are also needed, of course.

--
keywords: +easy
nosy: +eric.smith
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29890] Constructor of ipaddress.IPv*Interface does not follow documentation

2017-03-23 Thread Ilya Kulakov

New submission from Ilya Kulakov:

As per documentation, it should understand the same arguments as IPv*Network.

Unfortunately it does not recognize netmask in string form. Hence the following 
code will fail:

ipaddress.ip_interface(('192.168.1.10', '255.255.255.0'))

while the following will work:

ipaddress.ip_network(('192.168.1.10', '255.255.255.0'), strict=False)

--
messages: 290062
nosy: Ilya.Kulakov
priority: normal
severity: normal
status: open
title: Constructor of ipaddress.IPv*Interface does not follow documentation
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com