homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Will S
Recipients Will S, davin, eric.snow, python-dev
Date 2017年07月14日.18:56:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500058562.79.0.750573968736.issue28053@psf.upfronthosting.co.za>
In-reply-to
Content
Documentation would be appreciated. I have a project that uses BaseManager, Client, and Listener to create some servers and clients. I would like to update the project to work with Python 3 and would prefer to update the clients and the servers separately (i.e. switch the client to Python 3 while the server is run with Python 2.7). However, BaseManager uses connection.Client which uses connection._ConnectionBase which uses reduction.ForkingPickler without a protocol argument. It seems the default protocol is 3 on Python 3.6 and 2 on Python 2.7 (contrary to the comment above about v2 being used). I just want to set the protocol version to 2 in Python 3.6. Can I do that with the changes added by this patch?
I tried creating pickle2reducer.py like this:
from multiprocessing.reduction import ForkingPickler, AbstractReducer
class ForkingPickler2(ForkingPickler):
 def __init__(self, *args):
 if len(args) > 1:
 args[1] = 2
 else:
 args.append(2)
 super().__init__(*args)
 @classmethod
 def dumps(cls, obj, protocol=2):
 return ForkingPickler.dumps(obj, protocol)
def dump(obj, file, protocol=2):
 ForkingPickler2(file, protocol).dump(obj)
class Pickle2Reducer(AbstractReducer):
 ForkingPickler = ForkingPickler2
 register = ForkingPickler2.register
 dump = dump
and then putting
import pickle2reducer
multiprocessing.reducer = pickle2reducer.Pickle2Reducer()
at the top of my module before
import multiprocessing.connection
but I still see "ValueError: unsupported pickle protocol: 3" on the server when I connect with a Python 3.6 client.
History
Date User Action Args
2017年07月14日 18:56:02Will Ssetrecipients: + Will S, python-dev, eric.snow, davin
2017年07月14日 18:56:02Will Ssetmessageid: <1500058562.79.0.750573968736.issue28053@psf.upfronthosting.co.za>
2017年07月14日 18:56:02Will Slinkissue28053 messages
2017年07月14日 18:56:02Will Screate

AltStyle によって変換されたページ (->オリジナル) /