diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-05 12:53:49 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-08-05 12:53:49 (GMT) |
commit | 415d0f5cd3b2bb95c4a4da2f6a43a186335ae1a1 (patch) | |
tree | 8f9616dae5ee808ca0e09e2188ac57f695bd3466 /Lib | |
parent | 4adc9a8cc99c136fe1a03cdd69b5ad14ce5cbb5e (diff) | |
parent | 31096a94e71779af9c768ac714aaef8c4db53e10 (diff) | |
download | cpython-415d0f5cd3b2bb95c4a4da2f6a43a186335ae1a1.zip cpython-415d0f5cd3b2bb95c4a4da2f6a43a186335ae1a1.tar.gz cpython-415d0f5cd3b2bb95c4a4da2f6a43a186335ae1a1.tar.bz2 |
Merge
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/gzip.py | 6 | ||||
-rw-r--r-- | Lib/ipaddress.py | 10 | ||||
-rw-r--r-- | Lib/test/test_ipaddress.py | 4 |
3 files changed, 7 insertions, 13 deletions
diff --git a/Lib/gzip.py b/Lib/gzip.py index 5bcfe61..b6656a9 100644 --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -413,8 +413,10 @@ class GzipFile(io.BufferedIOBase): if self.fileobj is None: return b'' try: - # 1024 is the same buffering heuristic used in read() - self._read(max(n, 1024)) + # Ensure that we don't return b"" if we haven't reached EOF. + while self.extrasize == 0: + # 1024 is the same buffering heuristic used in read() + self._read(max(n, 1024)) except EOFError: pass offset = self.offset - self.extrastart diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index dfb5944..c9338c5 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1331,10 +1331,6 @@ class IPv4Interface(IPv4Address): return self._ip ^ self._prefixlen ^ int(self.network.network_address) @property - def prefixlen(self): - return self._prefixlen - - @property def ip(self): return IPv4Address(self._ip) @@ -1708,7 +1704,7 @@ class _BaseV6: hex_str = '%032x' % ip_int parts = [hex_str[x:x+4] for x in range(0, 32, 4)] if isinstance(self, (_BaseNetwork, IPv6Interface)): - return '%s/%d' % (':'.join(parts), self.prefixlen) + return '%s/%d' % (':'.join(parts), self._prefixlen) return ':'.join(parts) @property @@ -1947,10 +1943,6 @@ class IPv6Interface(IPv6Address): return self._ip ^ self._prefixlen ^ int(self.network.network_address) @property - def prefixlen(self): - return self._prefixlen - - @property def ip(self): return IPv6Address(self._ip) diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py index 061c866..09b4a5e 100644 --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -731,8 +731,8 @@ class IpaddrUnitTest(unittest.TestCase): '2001:658:22a:cafe:ffff:ffff:ffff:ffff') def testGetPrefixlen(self): - self.assertEqual(self.ipv4_interface.prefixlen, 24) - self.assertEqual(self.ipv6_interface.prefixlen, 64) + self.assertEqual(self.ipv4_interface.network.prefixlen, 24) + self.assertEqual(self.ipv6_interface.network.prefixlen, 64) def testGetSupernet(self): self.assertEqual(self.ipv4_network.supernet().prefixlen, 23) |