Issue 939395: cPickle.Pickler: in list mode, no way to set protocol (original) (raw)
Issue939395
Created on 2004-04-21 16:14 by jbelmonte, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg20553 - (view) | Author: John Belmonte (jbelmonte) * | Date: 2004-04-21 16:14 |
cPickle.Pickler may be called without arguments, which makes a special "list-based" pickler, allowing pickling to a string. However, there is no way to set the protocol in this mode. Either the Pickler initializer should support keywords (reported in separate bug), allowing "Pickler(proto=2)", or the list mode should also be triggered when the file argument is None, allowing "Pickler(None, 2)". | ||
msg20554 - (view) | Author: Tim Peters (tim.peters) * ![]() |
Date: 2004-04-21 16:46 |
Logged In: YES user_id=31435 This is undocumented, hence unsupported. pickle.py doesn't allow it either. So any enhancement first requires a debate about whether this should be a supported use (and, if it is, pickle.py needs to be changed to match it). Before then, any use of this is at-your-own-risk. In the meantime, you *can* set the protocol in this undocumented mode: >>> import cPickle >>> p = cPickle.Pickler(2) >>> Works fine. The constructor does undocumented type- sniffing on its argument to determine whether it was passed an integer (which is taken to be a protocol argument), or not (then it's taken to be a file-like object). There's no claim here that this doesn't all suck, but since it's all undocumented and unsupported, it's allowed to suck . | ||
msg58058 - (view) | Author: Alexandre Vassalotti (alexandre.vassalotti) * ![]() |
Date: 2007-12-01 17:44 |
Please mark this bug as Won't Fix. As Tim said, the list-based interface of cPickle is unsupported and pending removal. Please use the pickle.dumps and pickle.loads functions if you want string interface to pickle. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:56:03 | admin | set | github: 40172 |
2007-12-01 18:15:32 | georg.brandl | set | status: open -> closedresolution: wont fix |
2007-12-01 17:44:29 | alexandre.vassalotti | set | nosy: + alexandre.vassalottimessages: + |
2004-04-21 16:14:25 | jbelmonte | create |