[issue7689] Pickling of classes with a metaclass and copy_reg

Gerald Dalley report at bugs.python.org
Wed Jun 16 22:49:34 CEST 2010


Gerald Dalley <dalleyg at deshaw.com> added the comment:

Another use case: for distributed processing, it's handy to be able to pickle interactive functions and functions that are part of a script.  The user can then remotely execute a broader set of functions than can be pickled by default.  This is especially helpful for interactive exploration of data.

Pickling most types of functions is possible by serializing a function's bytecode, etc. and registering a handler with copy_reg.  Unfortunately, this handler is ignored under some conditions (e.g. copy_reg is ignored when attempting to serialize top-level functions in a script) but the copy_reg handler does get used for lambdas and inner functions.  This patch looks like it will allow FunctionType's pickle handler to be overridden in all cases.

----------
nosy: +dalleyg

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7689>
_______________________________________


More information about the Python-bugs-list mailing list