[Python-checkins] cpython: Issue #12996: multiprocessing.connection: transmit the header in network byte
charles-francois.natali
python-checkins at python.org
Tue Sep 20 19:25:52 CEST 2011
http://hg.python.org/cpython/rev/9c1c81d24e23
changeset: 72421:9c1c81d24e23
user: Charles-François Natali <neologix at free.fr>
date: Tue Sep 20 19:27:39 2011 +0200
summary:
Issue #12996: multiprocessing.connection: transmit the header in network byte
order (endpoints machines can have different endianness).
files:
Lib/multiprocessing/connection.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py
--- a/Lib/multiprocessing/connection.py
+++ b/Lib/multiprocessing/connection.py
@@ -422,7 +422,7 @@
def _send_bytes(self, buf):
# For wire compatibility with 3.2 and lower
n = len(buf)
- self._send(struct.pack("=i", len(buf)))
+ self._send(struct.pack("!i", n))
# The condition is necessary to avoid "broken pipe" errors
# when sending a 0-length buffer if the other end closed the pipe.
if n > 0:
@@ -430,7 +430,7 @@
def _recv_bytes(self, maxsize=None, sentinels=()):
buf = self._recv(4, sentinels)
- size, = struct.unpack("=i", buf.getvalue())
+ size, = struct.unpack("!i", buf.getvalue())
if maxsize is not None and size > maxsize:
return None
return self._recv(size, sentinels)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list