summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing/reduction.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-08-19 21:30:55 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-08-19 21:30:55 (GMT)
commit949d47dc7adc464c0c70b258a02b89fd67791c1a (patch)
tree7b1528484d3eb3defb05b9f7abab77e06f762951 /Lib/multiprocessing/reduction.py
parent3ad89100c1479a953ec10264d9aa1b13df1e59cb (diff)
downloadcpython-949d47dc7adc464c0c70b258a02b89fd67791c1a.zip
cpython-949d47dc7adc464c0c70b258a02b89fd67791c1a.tar.gz
cpython-949d47dc7adc464c0c70b258a02b89fd67791c1a.tar.bz2
Issue #3125: Remove copy_reg in multiprocessing and replace it with
ForkingPickler.register() to resolve conflict with ctypes.
Diffstat (limited to 'Lib/multiprocessing/reduction.py')
-rw-r--r--Lib/multiprocessing/reduction.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/Lib/multiprocessing/reduction.py b/Lib/multiprocessing/reduction.py
index 010d871..1813729 100644
--- a/Lib/multiprocessing/reduction.py
+++ b/Lib/multiprocessing/reduction.py
@@ -13,11 +13,10 @@ import os
import sys
import socket
import threading
-import copyreg
import _multiprocessing
from multiprocessing import current_process
-from multiprocessing.forking import Popen, duplicate, close
+from multiprocessing.forking import Popen, duplicate, close, ForkingPickler
from multiprocessing.util import register_after_fork, debug, sub_debug
from multiprocessing.connection import Client, Listener
@@ -134,7 +133,7 @@ def rebuild_handle(pickled_data):
return new_handle
#
-# Register `_multiprocessing.Connection` with `copy_reg`
+# Register `_multiprocessing.Connection` with `ForkingPickler`
#
def reduce_connection(conn):
@@ -147,10 +146,10 @@ def rebuild_connection(reduced_handle, readable, writable):
handle, readable=readable, writable=writable
)
-copyreg.pickle(_multiprocessing.Connection, reduce_connection)
+ForkingPickler.register(_multiprocessing.Connection, reduce_connection)
#
-# Register `socket.socket` with `copy_reg`
+# Register `socket.socket` with `ForkingPickler`
#
def fromfd(fd, family, type_, proto=0):
@@ -169,10 +168,10 @@ def rebuild_socket(reduced_handle, family, type_, proto):
close(fd)
return _sock
-copyreg.pickle(socket.socket, reduce_socket)
+ForkingPickler.register(socket.socket, reduce_socket)
#
-# Register `_multiprocessing.PipeConnection` with `copy_reg`
+# Register `_multiprocessing.PipeConnection` with `ForkingPickler`
#
if sys.platform == 'win32':
@@ -187,4 +186,4 @@ if sys.platform == 'win32':
handle, readable=readable, writable=writable
)
- copyreg.pickle(_multiprocessing.PipeConnection, reduce_pipe_connection)
+ ForkingPickler.register(_multiprocessing.PipeConnection, reduce_pipe_connection)