Commit 846fd302 authored by Antoine Pitrou's avatar Antoine Pitrou

Issue #14335: multiprocessing's custom Pickler subclass now inherits from the...

Issue #14335: multiprocessing's custom Pickler subclass now inherits from the C-accelerated implementation.
Patch by sbt.
parent d6569589
...@@ -55,18 +55,18 @@ def assert_spawning(self): ...@@ -55,18 +55,18 @@ def assert_spawning(self):
# Try making some callable types picklable # Try making some callable types picklable
# #
from pickle import _Pickler as Pickler from pickle import Pickler
from copyreg import dispatch_table
class ForkingPickler(Pickler): class ForkingPickler(Pickler):
dispatch = Pickler.dispatch.copy() _extra_reducers = {}
def __init__(self, *args):
Pickler.__init__(self, *args)
self.dispatch_table = dispatch_table.copy()
self.dispatch_table.update(self._extra_reducers)
@classmethod @classmethod
def register(cls, type, reduce): def register(cls, type, reduce):
def dispatcher(self, obj): cls._extra_reducers[type] = reduce
rv = reduce(obj)
if isinstance(rv, str):
self.save_global(obj, rv)
else:
self.save_reduce(obj=obj, *rv)
cls.dispatch[type] = dispatcher
def _reduce_method(m): def _reduce_method(m):
if m.__self__ is None: if m.__self__ is None:
......
...@@ -27,6 +27,9 @@ Core and Builtins ...@@ -27,6 +27,9 @@ Core and Builtins
Library Library
------- -------
- Issue #14335: multiprocessing's custom Pickler subclass now inherits from
the C-accelerated implementation. Patch by sbt.
- Issue #10484: Fix the CGIHTTPServer's PATH_INFO handling problem. - Issue #10484: Fix the CGIHTTPServer's PATH_INFO handling problem.
- Issue #11199: Fix the with urllib which hangs on particular ftp urls. - Issue #11199: Fix the with urllib which hangs on particular ftp urls.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment