diff options
author | Hynek Schlawack <hs@ox.cx> | 2012-06-08 13:21:21 (GMT) |
---|---|---|
committer | Hynek Schlawack <hs@ox.cx> | 2012-06-08 13:21:21 (GMT) |
commit | ed36b2e55be884afb7517905e02da313973998d1 (patch) | |
tree | 637d52faba50d2a06e7b094ca957375f03af05f0 /Lib/ipaddress.py | |
parent | 571ee57695ac5214341b2a94a873e4737fda1a9a (diff) | |
download | cpython-ed36b2e55be884afb7517905e02da313973998d1.zip cpython-ed36b2e55be884afb7517905e02da313973998d1.tar.gz cpython-ed36b2e55be884afb7517905e02da313973998d1.tar.bz2 |
#14814: Remove redundant code from ipaddress.IPv6Network
The strict checks and netmask computing don't make sense if constructed with
a ALL_ONES mask based on addresses. Also fix a bug due to mis-indentation of
a return statement in the same code block.
Diffstat (limited to 'Lib/ipaddress.py')
-rw-r--r-- | Lib/ipaddress.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index 7a87994..abbdcf8 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1990,12 +1990,6 @@ class IPv6Network(_BaseV6, _BaseNetwork): self.network_address = IPv6Address(address) self._prefixlen = self._max_prefixlen self.netmask = IPv6Address(self._ALL_ONES) - if strict: - if (IPv6Address(int(self.network_address) & - int(self.netmask)) != self.network_address): - raise ValueError('%s has host bits set' % str(self)) - self.network_address = IPv6Address(int(self.network_address) & - int(self.netmask)) return # Constructing from a packed address @@ -2004,13 +1998,7 @@ class IPv6Network(_BaseV6, _BaseNetwork): self.network_address = IPv6Address((tmp[0] << 64) | tmp[1]) self._prefixlen = self._max_prefixlen self.netmask = IPv6Address(self._ALL_ONES) - if strict: - if (IPv6Address(int(self.network_address) & - int(self.netmask)) != self.network_address): - raise ValueError('%s has host bits set' % str(self)) - self.network_address = IPv6Address(int(self.network_address) & - int(self.netmask)) - return + return # Assume input argument to be string or any object representation # which converts into a formatted IP prefix string. |