| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Fixes private checks for network objects. The previous method would incorrectly return True for a private check in cases such as "0.0.0.0/0".
|
| |
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ipaddress.ip_{address,network,interface} helper functions (#30642)
`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the `ipaddress.ip_*` helper because of the %-formatting now expecting several arguments:
In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
...
TypeError: not all arguments converted during string formatting
Compared to:
In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
...
NetmaskValueError: 'foo' is not a valid netmask
Use an f-string to make sure the error is always properly formatted.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
| |
|
|
|
|
|
| |
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check.
Automerge-Triggered-By: GH:gpshead
|
|
|
|
| |
- Enum warning in test_faulthandler
- backslash warning in test_ipaddress
|
|
|
|
|
|
|
|
|
| |
Reverts commit e653d4d8e820a7a004ad399530af0135b45db27a and makes
parsing even more strict. Like socket.inet_pton() any leading zero
is now treated as invalid input.
Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
|
|
|
|
|
|
|
| |
(GH-21033)
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
|
| |
|
|
|
|
|
|
| |
networks (GH-18757)
The `.hosts()` method now returns the single address present in a /32 or /128 network.
|
|
|
| |
Automerge-Triggered-By: @asvetlov
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bits method and test_bits
* Cleaned up assert string
* blurb
* added docstring
* Faster method, per Eric Smith
* redoing as __format__
* added ipv6 method
* test cases and cleanup
* updated news
* cleanup and NEWS.d
* cleaned up old NEWS
* removed cut and paste leftover
* one more cleanup
* moved to regexp, moved away from v4- and v6-specific versions of __format__
* More cleanup, added ipv6 test cases
* more cleanup
* more cleanup
* cleanup
* cleanup
* cleanup per review, part 1
* addressed review comments around help string and regexp matching
* wrapped v6 test strings. contiguous integers: break at 72char. with underscores: break so that it looks clean.
* 's' and '' tests for pv4 and ipv6
* whitespace cleanup
* Remove trailing whitespace
* Remove more trailing whitespace
* Remove an excess blank line
|
|
|
|
|
|
|
|
|
| |
(GH-14996)
There was a discrepancy between the Python and C implementations.
Add singletons ALWAYS_EQ, LARGEST and SMALLEST in test.support
to test mixed type comparison.
|
|
|
|
| |
(GH-13298)
|
|
|
|
|
|
|
| |
IPv4Interface and IPv6Interface did not has netmask and hostmask
attributes when its argument is bytes or int.
This commit extracts method for constructors of Network and Interface,
and ensure Interface class always provides them.
|
|
|
|
| |
* cached_property is more efficient than hand crafted cache.
* In IPv[46]Network, `self.network.prefixlen` is same to `self._prefixlen`.
|
| |
|
|
|
|
|
|
|
|
|
| |
Stop rejecting IPv4 octets with leading zeroes as ambiguously octal.
Plenty of other tools generate decimal IPv4 octets with leading zeroes,
so keeping this check hurts interoperability.
Patch by Joel Croteau.
|
|
|
|
|
|
| |
The result of host() was not empty when the network is constructed by a tuple containing an
integer mask and only 1 bit left for addresses.
|
|
|
|
| |
Original patch by Jon Foster and Berker Peksag.
|
| |
|
|
|
|
|
|
|
|
| |
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie
add more ip_interface comparison tests
|
| |
|
| |
|
|\ |
|
| | |
|
|/
|
|
| |
Patch by Gareth Rees.
|
|
|
|
|
|
| |
It was documented since 07a5610bae9d.
Initial patch by Roger Luethi.
|
|
|
|
| |
Patch by Tommy Beadle.
|
|
|
|
|
| |
when resulting prefix length is equal to maximal prefix length.
Based on patch by Xiang Zhang.
|
|
|
|
| |
Davis reviewing code.
|
|\ |
|
| |
| |
| |
| |
| |
| | |
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
|
| | |
|
|\ \
| |/ |
|
| | |
|
| |
| |
| |
| | |
duplicated addresses and simplify the code.
|
| | |
|
| |
| |
| |
| | |
portable representation.
|
| |
| |
| |
| | |
when there are many non-consecutive addresses.
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| | |
Patch by Michel Albert. We don't normally do patches that just tweak
whitespace, but ipaddress is relatively new and the package maintainers
approved the patch.
|
| |
| |
| |
| | |
(address, netmask) tuple argument, so as to easily construct network objects from existing addresses.
|
|/ |
|
|\ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
| | |
|