summaryrefslogtreecommitdiff
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorPeter Moody <python@hda3.com>2013-10-22 12:36:21 -0700
committerPeter Moody <python@hda3.com>2013-10-22 12:36:21 -0700
commit5df7729b06cc6225e126cccb9d00d0ca7ac1d167 (patch)
tree19aab35f878aa0c313cc4a806fa6214be9e44550 /Lib/ipaddress.py
parent19fabb0cb1314c5250d244655290c7685e9ab6a7 (diff)
downloadcpython-5df7729b06cc6225e126cccb9d00d0ca7ac1d167.tar.gz
#17400: fix documentation, add cache to is_global and correctly handle 100.64.0.0/10
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index 53423e2ad0..79361920b5 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -984,7 +984,7 @@ class _BaseNetwork(_IPAddressBase):
@property
def is_global(self):
- """Test if this address is allocated for private networks.
+ """Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
@@ -1233,6 +1233,7 @@ class IPv4Address(_BaseV4, _BaseAddress):
return self in reserved_network
@property
+ @functools.lru_cache()
def is_private(self):
"""Test if this address is allocated for private networks.
@@ -1259,14 +1260,14 @@ class IPv4Address(_BaseV4, _BaseAddress):
@property
def is_global(self):
- """Test if this address is allocated for private networks.
+ """Test if this address is allocated for public networks.
Returns:
A boolean, True if the address is not reserved per
iana-ipv4-special-registry.
"""
- return not self.is_private
+ return self in IPv4Network('100.64.0.0/10') or not self.is_private
@property
@@ -1856,6 +1857,7 @@ class IPv6Address(_BaseV6, _BaseAddress):
return self in sitelocal_network
@property
+ @functools.lru_cache()
def is_private(self):
"""Test if this address is allocated for private networks.