no pickling code objects?

holger krekel pyth at devel.trillke.net
Thu May 9 05:40:20 EDT 2002


Gon?alo Rodrigues wrote:
> Hi,
> 
> On the docs on the pickle module it says that code objects can not be
> pickled, this in turn implies some limitations on the pickleability
> (man, I like this word!) of some objects. The docs mention security
> reasons for this choice. But somehow this doesn't feel right. Shouldn't
> the secuity concerns be left to the programmers? After all Python
> already has exec*. Is there something I am missing?
> 
> I am asking this mainly from curiosity, I am in no need of such a
> feature. And then again, If I had the time and the knowedge + skill to
> come up with a patch...

just a comment: i need pickling of code objects. Anyone implementing
mobile network agents might be interested, also. Up until now
i just grab the source/byte code and send it over as a string.

But the basic problem with pickling/unpickling code objects
is to transport the transitive closure of code objects: you need to
have the code objects which your pickled code objects
depends on. And next the code objects which these code
objects depend on ...

At the same time you don't want to pickle code of
the python standard distribution usually (at least
not sys/os and friends).  

Has anyone figured these issues out already?

    holger





More information about the Python-list mailing list