summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-109466: Add ipv6_mapped property to IPv4Address (#109467)Charles Machalow2023-11-051-0/+10
| | | | | Adds the `IPv4Address.ipv6_mapped` property. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-110196: Fix ipaddress.IPv6Address.__reduce__ (GH-110198)Tian Gao2023-10-221-0/+3
|
* gh-87799: Improve the textual representation of IPv4-mapped IPv6 addresses ↵opavliuk2023-07-311-1/+33
| | | | | | | | | | | | | | | (#29345) Represent IPv4-mapped IPv6 address as x:x:x:x:x:x:d.d.d.d, where the 'x's are the hexadecimal values of the six high-order 16-bit pieces of the address, and the 'd's are the decimal values of the four low-order 8-bit pieces of the address (standard IPv4 representation). --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* ipaddress: Remove non-existent ip_str param from docstring (#103461)Sergii Dymchenko2023-04-141-3/+0
|
* gh-82836: fix private network check (#97733)Pete Wicken2022-11-291-4/+16
| | | 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".
* bpo-46415: Use f-string for ValueError in ↵Thomas Cellerier2022-05-031-9/+6
| | | | | | | | | | | | | | | | | | | | | | 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>
* bpo-45155: Apply new byteorder default values for int.to/from_bytes (GH-28465)Raymond Hettinger2021-09-201-3/+3
|
* bpo-33433 Fix private address checking for IPv4 mapped IPv6. (GH-26172)Pete Wicken2021-05-171-1/+6
| | | | | 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
* bpo-36384: Leading zeros in IPv4 addresses are no longer tolerated (GH-25099)Christian Heimes2021-05-021-0/+5
| | | | | | | | | 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>
* bpo-41521: Replace whitelist/blacklist with allowlist/denylist (GH-21822)Victor Stinner2020-08-111-2/+2
| | | Automerge-Triggered-By: @tiran
* bpo-41482: Fix error in ipaddress.IPv4Network docstring (GH-21736)Eric L. Frederich2020-08-051-1/+1
|
* bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface ↵Ravi Teja P2020-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
* 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
|/