summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddress.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-06-11 19:12:36 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2016-06-11 19:12:36 (GMT)
commit24b102e6e86df006e90e2b73353e903840ea0327 (patch)
tree48f08cdd662f131766463f05dc703f8ef34b8ca4 /Lib/ipaddress.py
parent4da945f361cda03104548f49bad690a54b0209f7 (diff)
parent742192a4fea88b49633288fb6e5bea68cf0bdcc0 (diff)
downloadcpython-24b102e6e86df006e90e2b73353e903840ea0327.zip
cpython-24b102e6e86df006e90e2b73353e903840ea0327.tar.gz
cpython-24b102e6e86df006e90e2b73353e903840ea0327.tar.bz2
Issue #21386: Merge from 3.5
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r--Lib/ipaddress.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py
index ca3031a..1f90058 100644
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1312,6 +1312,11 @@ class IPv4Address(_BaseV4, _BaseAddress):
return any(self in net for net in self._constants._private_networks)
@property
+ @functools.lru_cache()
+ def is_global(self):
+ return self not in self._constants._public_network and not self.is_private
+
+ @property
def is_multicast(self):
"""Test if the address is reserved for multicast use.
@@ -1557,6 +1562,8 @@ class _IPv4Constants:
_multicast_network = IPv4Network('224.0.0.0/4')
+ _public_network = IPv4Network('100.64.0.0/10')
+
_private_networks = [
IPv4Network('0.0.0.0/8'),
IPv4Network('10.0.0.0/8'),