summaryrefslogtreecommitdiffstats
path: root/Lib/ipaddr.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-05-02 17:33:01 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-05-02 17:33:01 (GMT)
commit62821691426f06cf7632b28d730e405fa31dead7 (patch)
tree881446a2402d8f8c4e0cb64d425d78ed41990bac /Lib/ipaddr.py
parent92b970037b12cc3471c9db48959af071351cffee (diff)
downloadcpython-62821691426f06cf7632b28d730e405fa31dead7.zip
cpython-62821691426f06cf7632b28d730e405fa31dead7.tar.gz
cpython-62821691426f06cf7632b28d730e405fa31dead7.tar.bz2
remove py3k compat code
Diffstat (limited to 'Lib/ipaddr.py')
-rw-r--r--Lib/ipaddr.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/Lib/ipaddr.py b/Lib/ipaddr.py
index c95a814..d6ea310 100644
--- a/Lib/ipaddr.py
+++ b/Lib/ipaddr.py
@@ -193,17 +193,6 @@ def collapse_address_list(addresses):
sorted(addresses, key=BaseIP._get_networks_key))
-# Test whether this Python implementation supports byte objects that
-# are not identical to str ones.
-# We need to exclude platforms where bytes == str so that we can
-# distinguish between packed representations and strings, for example
-# b'12::' (the IPv4 address 49.50.58.58) and '12::' (an IPv6 address).
-try:
- _compat_has_real_bytes = bytes != str
-except NameError: # <Python2.6
- _compat_has_real_bytes = False
-
-
class BaseIP(object):
"""A generic IP object.
@@ -591,14 +580,6 @@ class IPv4(BaseIP):
raise IPv4IpValidationError(ipaddr)
return
- # Constructing from a packed address
- if _compat_has_real_bytes:
- if isinstance(ipaddr, bytes) and len(ipaddr) == 4:
- self.ip = struct.unpack('!I', ipaddr)[0]
- self._prefixlen = 32
- self.netmask = self._ALL_ONES
- return
-
# Assume input argument to be string or any object representation
# which converts into a formatted IP prefix string.
addr = str(ipaddr).split('/')
@@ -930,15 +911,6 @@ class IPv6(BaseIP):
raise IPv6IpValidationError(ipaddr)
return
- # Constructing from a packed address
- if _compat_has_real_bytes:
- if isinstance(ipaddr, bytes) and len(ipaddr) == 16:
- tmp = struct.unpack('!QQ', ipaddr)
- self.ip = (tmp[0] << 64) | tmp[1]
- self._prefixlen = 128
- self.netmask = self._ALL_ONES
- return
-
# Assume input argument to be string or any object representation
# which converts into a formatted IP prefix string.
addr_str = str(ipaddr)