diff options
author | Charles-François Natali <neologix@free.fr> | 2011-09-20 17:27:39 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-09-20 17:27:39 (GMT) |
commit | 225aa4f8ec1d98a244f863ee5257a750926a494e (patch) | |
tree | 4664f8b624c0ed60a493701bd6be3a7062e51495 /Lib/multiprocessing | |
parent | 6fa67775033d99a8a0e5b978d37ef00aed6c1fbe (diff) | |
download | cpython-225aa4f8ec1d98a244f863ee5257a750926a494e.zip cpython-225aa4f8ec1d98a244f863ee5257a750926a494e.tar.gz cpython-225aa4f8ec1d98a244f863ee5257a750926a494e.tar.bz2 |
Issue #12996: multiprocessing.connection: transmit the header in network byte
order (endpoints machines can have different endianness).
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r-- | Lib/multiprocessing/connection.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index ae2d135..13d3d77 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -422,7 +422,7 @@ class Connection(_ConnectionBase): 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 @@ class Connection(_ConnectionBase): 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) |