Commit Graph

71 Commits

Author SHA1 Message Date
Mariusz Felisiak 1a8c778471
Remove duplicate address in CommonTestMixin_v4.test_leading_zeros() (GH-26326) 2021-06-02 13:30:13 +01:00
Pete Wicken 83f0f8d62f
bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)
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
2021-05-17 00:52:36 -07:00
Ethan Furman 652bcd9f9c
fix enum and backslash warnings (GH-25861)
- Enum warning in test_faulthandler
- backslash warning in test_ipaddress
2021-05-03 18:44:30 -07:00
Christian Heimes 60ce8f0be6
bpo-36384: Leading zeros in IPv4 addresses are no longer tolerated (GH-25099)
Reverts commit e653d4d8e8 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>
2021-05-02 14:00:35 +02:00
Ravi Teja P b30ee26e36
bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (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
2020-06-29 13:39:29 -04:00
Victor Stinner b1e11c31c5
bpo-40443: Remove unused imports in tests (GH-19804) 2020-04-30 02:21:30 +02:00
Pete Wicken 8e9c47a947
bpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 networks (GH-18757)
The `.hosts()` method now returns the single address present in a /32 or /128 network.
2020-03-09 15:33:45 -07:00
opavlyuk 21da76d1f1
bpo-34788: Add support for scoped IPv6 addresses (GH-13772)
Automerge-Triggered-By: @asvetlov
2020-02-26 06:33:57 -08:00
ewosborne f9c95a4ba2 bpo-32820: __format__ method for ipaddress (#5627)
* 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
2019-09-12 10:03:31 +01:00
Serhiy Storchaka 17e52649c0
bpo-37685: Fixed comparisons of datetime.timedelta and datetime.timezone. (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.
2019-08-04 12:38:46 +03:00
Nicolai Moore 5e48e3db6f bpo-36845: validate integer network prefix when constructing IP networks (GH-13298) 2019-05-14 19:32:59 +09:00
Inada Naoki 6fa84bd12c
bpo-27860: ipaddress: fix Interface missed some attributes (GH-12836)
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.
2019-04-16 08:32:28 +09:00
Inada Naoki 2430d532e2
bpo-27860: use cached_property (GH-12832)
* cached_property is more efficient than hand crafted cache.
* In IPv[46]Network, `self.network.prefixlen` is same to `self._prefixlen`.
2019-04-15 16:01:00 +09:00
Rémi Lapeyre e59ec1b05d bpo-35734: ipaddress: remove unused methods (GH-11591) 2019-04-13 17:49:34 +09:00
Joel Croteau e653d4d8e8 bpo-36384: Remove check for leading zeroes in IPv4 addresses (GH-12577)
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.
2019-03-31 00:53:48 +10:00
Xiang Zhang 10b134a07c
bpo-27683: Fix a regression for host() of ipaddress network objects (GH-6016)
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.
2018-03-21 08:25:13 +08:00
Cheryl Sabella 5609b78392 bpo-18802: Add more details to ipaddress documentation (GH-6083)
Original patch by Jon Foster and Berker Peksag.
2018-03-21 08:09:15 +08:00
Cheryl Sabella 91dc64ba3f bpo-20825: Containment test for ip_network in ip_network. 2017-10-22 23:39:49 +02:00
s-sanjay 7bd8d3e794 bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (#879)
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
2017-04-01 09:09:53 +03:00
Serhiy Storchaka 5f1a5187f7 Use sequence repetition instead of bytes constructor with integer argument. 2016-09-11 14:41:02 +03:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Martin Panter 702f4f5d6f Issue #23804: Merge spelling and NEWS fixes from 3.5 2016-07-11 12:54:44 +00:00
Martin Panter 204bf0b9ae English spelling and grammar fixes 2016-07-11 07:51:37 +00:00
Berker Peksag 28dc1186a8 Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__
Patch by Gareth Rees.
2016-06-11 22:30:05 +03:00
Berker Peksag 742192a4fe Issue #21386: Implement missing IPv4Address.is_global property
It was documented since 07a5610bae9d.

Initial patch by Roger Luethi.
2016-06-11 22:11:47 +03:00
R David Murray 947ff38725 #20973: add total ordering tests for ipaddress
Patch by Tommy Beadle.
2016-06-02 15:46:04 -04:00
Serhiy Storchaka bb0dbd583b Issue #26457: Fixed the subnets() methods in IP network classes for the case
when resulting prefix length is equal to maximal prefix length.
Based on patch by Xiang Zhang.
2016-03-01 10:25:45 +02:00
Gregory P. Smith 9ecf00e7cb Remove a duplicate test_addresses key:value as identified by Vincent
Davis reviewing code.
2016-01-01 17:41:46 -08:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
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.
2015-11-02 03:37:02 +00:00
Serhiy Storchaka 88f64f392c Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address. 2015-03-07 20:08:34 +02:00
Serhiy Storchaka ffd48c9e3d Issue #23268: Fixed bugs in the comparison of ipaddress classes. 2015-01-26 10:11:39 +02:00
Serhiy Storchaka f186e128b6 Issue #23268: Fixed bugs in the comparison of ipaddress classes. 2015-01-26 10:11:16 +02:00
Serhiy Storchaka b53f0fbf96 Issue #23266: Restore the performance of ipaddress.collapse_addresses() whith
duplicated addresses and simplify the code.
2015-01-19 00:41:32 +02:00
Serhiy Storchaka a556af77a7 Fixed tests for issue #23133 (pickling of IPv4Network was not tested). 2015-01-18 22:56:47 +02:00
Serhiy Storchaka 5f38f5c502 Issue #23133: Pickling of ipaddress objects now produces more compact and
portable representation.
2015-01-18 22:36:33 +02:00
Antoine Pitrou e6f250ed90 Issue #23266: Much faster implementation of ipaddress.collapse_addresses() when there are many non-consecutive addresses. 2015-01-18 16:22:47 +01:00
R David Murray b0f5686ba4 #20815: small readability improvements in ipaddress tests. 2014-10-12 15:17:44 -04:00
R David Murray 7567865867 #20815: small readability improvements in ipaddress tests.
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.
2014-10-12 15:17:22 -04:00
Antoine Pitrou 5fb195f854 Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept an (address, netmask) tuple argument, so as to easily construct network objects from existing addresses. 2014-05-12 20:36:46 +02:00
Eric V. Smith ebdaaf4087 Issue #20480: Add ipaddress.reverse_pointer. Patch by Leon Weber. 2014-04-14 12:58:07 -04:00
Serhiy Storchaka 99b1f2b3bb Issue #20553. Use specific asserts in ipaddress tests. 2014-02-08 16:39:51 +02:00
Serhiy Storchaka 7c389e2404 Issue #20553. Use specific asserts in ipaddress tests. 2014-02-08 16:38:35 +02:00
Nick Coghlan aad0ea0b59 Merge fix for #18805 from 3.3 2014-02-08 23:20:58 +10:00
Nick Coghlan 932346f572 Issue #18805: better netmask validation in ipaddress 2014-02-08 23:17:36 +10:00
Peter Moody e5019d5183 #17400: correct handling of 100.64.0.0/10, fixing the docs and updating NEWS 2013-10-24 09:47:10 -07:00
Peter Moody be9c1b133b #17400: fix documentation, add cache to is_global and correctly handle 100.64.0.0/10 2013-10-22 12:36:21 -07:00
Peter Moody 22c3176426 #17400; ipaddress should make it easy to identify rfc6598 addresses 2013-10-21 13:58:06 -07:00
Nick Coghlan a8517ad3d9 Issue #14814: document the Interface APIs and fix various problems with the string representations (initial patch by Eli Bendersky). 2012-08-20 10:04:26 +10:00
Nick Coghlan e3ded955f3 Issue #14814: Remove redundant property from interface objects - prefixlen can be accessed via the associated network object 2012-08-05 22:45:22 +10:00