Apply Amaury's patch to multiprocessing for issue 3125, removes the copy_reg and replaces it with ForkingPickler.register(), which should resolve the conflict with the global registry/ctypes

This commit is contained in:
Jesse Noller 2008-07-16 14:32:36 +00:00
parent a6c5dc07f4
commit 13e9d582fd
6 changed files with 69 additions and 57 deletions

View file

@ -9,10 +9,9 @@
import sys
import ctypes
import weakref
import copy_reg
from multiprocessing import heap, RLock
from multiprocessing.forking import assert_spawning
from multiprocessing.forking import assert_spawning, ForkingPickler
__all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized']
@ -127,8 +126,7 @@ def reduce_ctype(obj):
def rebuild_ctype(type_, wrapper, length):
if length is not None:
type_ = type_ * length
if sys.platform == 'win32' and type_ not in copy_reg.dispatch_table:
copy_reg.pickle(type_, reduce_ctype)
ForkingPickler.register(type_, reduce_ctype)
obj = type_.from_address(wrapper.get_address())
obj._wrapper = wrapper
return obj