Message345867
@George Xie
There is an issue with the Python workaround `multiprocessing.reduction.register(types.MethodType, my_reduce)` that you proposed. If you then instantiate a `multiprocessing.Manager()` you get this exception:
> python
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> import types
>>> def my_reduce(obj):
... return (obj.__func__.__get__, (obj.__self__,))
...
>>> multiprocessing.reduction.register(types.MethodType, my_reduce)
>>> multiprocessing.Manager()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 56, in Manager
m.start()
File "C:\Program Files\Python37\lib\multiprocessing\managers.py", line 543, in start
self._process.start()
File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "C:\Program Files\Python37\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\Program Files\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
reduction.dump(process_obj, to_child)
File "C:\Program Files\Python37\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
_pickle.PicklingError: Can't pickle <function BaseManager._run_server at 0x000001AEF8ED1D90>: it's not the same object as multiprocessing.managers.BaseManager._run_server
>>> Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\Program Files\Python37\lib\multiprocessing\spawn.py", line 115, in _main
self = reduction.pickle.load(from_parent)
EOFError: Ran out of input |
|
Date |
User |
Action |
Args |
2019-06-17 15:24:52 | maggyero | set | recipients:
+ maggyero, brett.cannon, rhettinger, pitrou, vstinner, christian.heimes, asvetlov, serhiy.storchaka, georgexsh |
2019-06-17 15:24:52 | maggyero | set | messageid: <1560785092.9.0.219611107476.issue37297@roundup.psfhosted.org> |
2019-06-17 15:24:52 | maggyero | link | issue37297 messages |
2019-06-17 15:24:52 | maggyero | create | |
|