[Python-checkins] cpython (merge default -> default): Merge
antoine.pitrou
python-checkins at python.org
Sun Aug 5 14:56:36 CEST 2012
http://hg.python.org/cpython/rev/df5c9f4ba3b5
changeset: 78435:df5c9f4ba3b5
parent: 78434:ee185c6b2880
parent: 78432:abbae7314b52
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sun Aug 05 14:53:49 2012 +0200
summary:
Merge
files:
Doc/library/ipaddress.rst | 6 ++++--
Lib/gzip.py | 6 ++++--
Lib/ipaddress.py | 10 +---------
Lib/test/test_ipaddress.py | 4 ++--
Misc/NEWS | 4 ++--
5 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst
--- a/Doc/library/ipaddress.rst
+++ b/Doc/library/ipaddress.rst
@@ -390,11 +390,13 @@
.. attribute:: network_address
- The broadcast address for the network.
+ The network address for the network. The network address and the
+ prefix length together uniquely define a network.
.. attribute:: broadcast_address
- The broadcast address for the network.
+ The broadcast address for the network. Packets sent to the broadcast
+ address should be received by every host on the network.
.. attribute:: host mask
diff --git a/Lib/gzip.py b/Lib/gzip.py
--- a/Lib/gzip.py
+++ b/Lib/gzip.py
@@ -413,8 +413,10 @@
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
--- a/Lib/ipaddress.py
+++ b/Lib/ipaddress.py
@@ -1331,10 +1331,6 @@
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 @@
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 @@
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
--- a/Lib/test/test_ipaddress.py
+++ b/Lib/test/test_ipaddress.py
@@ -731,8 +731,8 @@
'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)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -81,8 +81,8 @@
constructor, objects in the ipaddress module no longer implement __index__
(they still implement __int__ as appropriate)
-- Issue #15546: Fix handling of pathological input data in the read1() method of
- the BZ2File, GzipFile and LZMAFile classes.
+- Issue #15546: Fix handling of pathological input data in the peek() and
+ read1() methods of the BZ2File, GzipFile and LZMAFile classes.
- Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog
ended with '\'. Patch by Roger Serwy.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list