summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46415: Use f-string for ValueError in ↵Miss Islington (bot)2022-05-031-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | ipaddress.ip_{address,network,interface} helper functions (GH-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> (cherry picked from commit 52dc9c3066bcdc67a7a45d41cf158ecb1434d5f3) Co-authored-by: Thomas Cellerier <thomascellerier@gmail.com>
* bpo-36384: Leading zeros in IPv4 addresses are no longer tolerated ↵Miss Islington (bot)2021-05-021-0/+5
| | | | | | | | | | | | (GH-25099) (GH-25815) 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> (cherry picked from commit 60ce8f0be6354ad565393ab449d8de5d713f35bc)
* bpo-41482: Fix error in ipaddress.IPv4Network docstring (GH-21736)Miss Islington (bot)2020-08-051-1/+1
| | | | | (cherry picked from commit 52f98424a55e14f05dfa7483cc0faf634a61c9ff) Co-authored-by: Eric L. Frederich <eric.frederich@gmail.com>
* bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface ↵Miss Islington (bot)2020-06-291-2/+2
| | | | | | | | | | | (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 (cherry picked from commit b30ee26e366bf509b7538d79bfec6c6d38d53f28) Co-authored-by: Ravi Teja P <rvteja92@gmail.com>
* bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)Batuhan Taskaya2020-05-121-7/+0
| | | These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
* bpo-39481: PEP 585 for ipaddress.py (GH-19418)Batuhan Taşkaya2020-04-101-0/+6
|
* bpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 ↵Pete Wicken2020-03-091-0/+4
| | | | | | networks (GH-18757) The `.hosts()` method now returns the single address present in a /32 or /128 network.
* bpo-35712: Make using NotImplemented in a boolean context issue a ↵MojoVampire2020-03-031-3/+3
| | | | deprecation warning (GH-13195)
* bpo-34788: Add support for scoped IPv6 addresses (GH-13772)opavlyuk2020-02-261-2/+53
| | | Automerge-Triggered-By: @asvetlov
* bpo-32820: Simplify __format__ implementation for ipaddress. (GH-16378)Serhiy Storchaka2019-09-271-40/+19
| | | | Also cache the compiled RE for parsing the format specifier.
* bpo-32820: __format__ method for ipaddress (#5627)ewosborne2019-09-121-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* bpo-36845: validate integer network prefix when constructing IP networks ↵Nicolai Moore2019-05-141-0/+4
| | | | (GH-13298)
* bpo-25430: improve performance of IPNetwork.__contains__ (GH-1785)gescheit2019-04-301-2/+1
| | | make a compare in bit-operation manner.
* bpo-27860: ipaddress: fix Interface missed some attributes (GH-12836)Inada Naoki2019-04-151-70/+40
| | | | | | | 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.
* bpo-27860: use cached_property (GH-12832)Inada Naoki2019-04-151-26/+7
| | | | * cached_property is more efficient than hand crafted cache. * In IPv[46]Network, `self.network.prefixlen` is same to `self._prefixlen`.
* bpo-35734: ipaddress: remove unused methods (GH-11591)Rémi Lapeyre2019-04-131-55/+0
|
* bpo-36384: Remove check for leading zeroes in IPv4 addresses (GH-12577)Joel Croteau2019-03-301-6/+0
| | | | | | | | | 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.
* bpo-27683: Fix a regression for host() of ipaddress network objects (GH-6016)Xiang Zhang2018-03-211-71/+38
| | | | | | 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.
* ipaddress: Use str.isascii() instead of frozenset (GH-5811)INADA Naoki2018-02-231-3/+2
|
* bpo-20825: Containment test for ip_network in ip_network.Cheryl Sabella2017-10-221-6/+23
|
* bpo-29931 fix __lt__ check in ipaddress.ip_interface for both v4 and v6. (#879)s-sanjay2017-04-011-2/+4
| | | | | | | | 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
* Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__Berker Peksag2016-06-111-2/+2
| | | | Patch by Gareth Rees.
* Issue #21386: Implement missing IPv4Address.is_global propertyBerker Peksag2016-06-111-0/+7
| | | | | | It was documented since 07a5610bae9d. Initial patch by Roger Luethi.
* Issue #26457: Fixed the subnets() methods in IP network classes for the caseSerhiy Storchaka2016-03-011-9/+9
| | | | | when resulting prefix length is equal to maximal prefix length. Based on patch by Xiang Zhang.
* Issue #16261: Converted some bare except statements to except statementsSerhiy Storchaka2015-05-201-2/+2
| | | | with specified exception type. Original patch by Ramchandra Apte.
* Issue #23103: Reduced the memory consumption of IPv4Address and IPv6Address.Serhiy Storchaka2015-03-071-13/+12
|
* Issue #23268: Fixed bugs in the comparison of ipaddress classes.Serhiy Storchaka2015-01-261-40/+7
|\
| * Issue #23268: Fixed bugs in the comparison of ipaddress classes.Serhiy Storchaka2015-01-261-40/+7
| |
* | Issue #23266: Restore the performance of ipaddress.collapse_addresses() whithSerhiy Storchaka2015-01-181-20/+16
| | | | | | | | duplicated addresses and simplify the code.
* | Issue #23133: Pickling of ipaddress objects now produces more compact andSerhiy Storchaka2015-01-181-7/+14
| | | | | | | | portable representation.
* | Issue #23266: Much faster implementation of ipaddress.collapse_addresses() ↵Antoine Pitrou2015-01-181-6/+10
| | | | | | | | when there are many non-consecutive addresses.
* | PEP 479: Use the return-keyword instead of raising StopIteration inside a ↵Raymond Hettinger2014-11-231-1/+1
| | | | | | | | generators.
* | Issue #22823: Use set literals instead of creating a set from a listRaymond Hettinger2014-11-091-1/+1
| |
* | Issue #22186: Fix typos in Lib/.Berker Peksag2014-10-191-1/+1
|\ \ | |/ | | | | Patch by Févry Thibault.
| * Issue #22186: Fix typos in Lib/.Berker Peksag2014-10-191-1/+1
| | | | | | | | Patch by Févry Thibault.
* | Refactor precomputed constants in the ipaddress module (suggested by ↵Antoine Pitrou2014-05-231-58/+67
| | | | | | | | Charles-François)
* | Issue #21513: Speedup some properties of IP addresses (IPv4Address, ↵Antoine Pitrou2014-05-231-51/+69
| | | | | | | | IPv6Address) such as .is_private or .is_multicast.
* | Issue #20826: Optimize ipaddress.collapse_addresses().Antoine Pitrou2014-05-151-27/+26
| |
* | Issue #21487: Optimize ipaddress.summarize_address_range() and ↵Antoine Pitrou2014-05-151-21/+7
| | | | | | | | ipaddress.{IPv4Network,IPv6Network}.subnets().
* | Issue #21486: Optimize parsing of netmasks in ipaddress.IPv4Network and ↵Antoine Pitrou2014-05-151-79/+119
| | | | | | | | ipaddress.IPv6Network.
* | Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept an ↵Antoine Pitrou2014-05-121-21/+74
| | | | | | | | (address, netmask) tuple argument, so as to easily construct network objects from existing addresses.
* | Issue #20480: Add ipaddress.reverse_pointer. Patch by Leon Weber.Eric V. Smith2014-04-141-0/+29
|/
* Issue #19157: Include the broadcast address in the usuable hosts for IPv6Peter Moody2014-03-111-0/+12
| | | | in ipaddress.
* Merge fix for #18805 from 3.3Nick Coghlan2014-02-081-65/+83
|\
| * Issue #18805: better netmask validation in ipaddressNick Coghlan2014-02-081-65/+83
| |
* | #17400: correct handling of 100.64.0.0/10, fixing the docs and updating NEWSPeter Moody2013-10-241-12/+15
| |
* | #17400: fix documentation, add cache to is_global and correctly handle ↵Peter Moody2013-10-221-3/+5
| | | | | | | | 100.64.0.0/10
* | #17400; ipaddress should make it easy to identify rfc6598 addressesPeter Moody2013-10-211-11/+65
|/
* #18705: fix a number of typos. Patch by Févry Thibault.Ezio Melotti2013-08-171-2/+2
|
* Fix a few typos and a double semicolon. Patch by Eitan Adler.Ezio Melotti2013-01-271-1/+1
|