Safe Pickling

Heiko Wundram heiko at ph0enix.homelinux.org
Fri May 23 12:08:18 EDT 2003


Hi All!

I've read about safe/unsafe pickling in the documentation of Python 2.2,
which states that you need to make sure that load_globals is zero in the
Pickler you get with cPickle.Pickler().

The 2.3 documentation doesn't state anything on that topic (at least it
didn't two days ago). Can I assume that default (and unchangeable)
behaviour now is to allow all pickles? (haven't tried out the 2.2
documentation hint yet... :))

Anyway, what I basically need is a module to pickle _basic_ Python
types, meaning string, int, float, list, tuple, dict, and boolean. As
the pickles that I get will be coming from a network, "unsafe" pickling
is not an option.

I've read about the XML-Pickler and several other attempts at pickling
Python objects that are called "safe", but I really don't want to use
any non-standard module.

I've tried implementing my own pickler in the last few days, but that
seems so much of an overhead for a little project, that I'd gratefully
request any hint that I can get...

Thanks in advance!

Heiko Wundram.






More information about the Python-list mailing list