[Python-Dev] undesireable unpickle behavior, proposed fix

Alexandre Vassalotti alexandre at peadrop.com
Wed Jan 28 03:51:04 CET 2009


On Tue, Jan 27, 2009 at 5:16 PM, Jake McGuire <jake at youtube.com> wrote:
> Another vaguely related change would be to store string and unicode objects
> in the pickler memo keyed as themselves rather than their object ids.

That wouldn't be difficult to do--i.e., simply add a type check in
Pickler.memoize and another in Pickler.save().  But I am not sure if
that would be a good idea, since you would end up hashing every string
pickled. And, that would probably be expensive if you are pickling for
long strings.

-- Alexandre


More information about the Python-Dev mailing list