From a655075d162b5b14677bf6620bc255f4391b151a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Sun, 24 Mar 2013 15:21:49 +0100 Subject: Issue #17025: Add dumps() and loads() to ForkingPickler. --- Lib/multiprocessing/connection.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'Lib/multiprocessing/connection.py') diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 9a357f6366..4dd6502c87 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -12,7 +12,6 @@ __all__ = [ 'Client', 'Listener', 'Pipe', 'wait' ] import io import os import sys -import pickle import select import socket import struct @@ -202,9 +201,7 @@ class _ConnectionBase: """Send a (picklable) object""" self._check_closed() self._check_writable() - buf = io.BytesIO() - ForkingPickler(buf, pickle.HIGHEST_PROTOCOL).dump(obj) - self._send_bytes(buf.getbuffer()) + self._send_bytes(ForkingPickler.dumps(obj)) def recv_bytes(self, maxlength=None): """ @@ -249,7 +246,7 @@ class _ConnectionBase: self._check_closed() self._check_readable() buf = self._recv_bytes() - return pickle.loads(buf.getbuffer()) + return ForkingPickler.loads(buf.getbuffer()) def poll(self, timeout=0.0): """Whether there is any input available to be read""" -- cgit v1.2.1