[Python-Dev] Pickle implementation questions

Bruce Christensen t-bruch at microsoft.com
Fri Jun 30 03:17:29 CEST 2006


In developing a cPickle module for IronPython that's as compatible as
possible with CPython, these questions have come up: 

 - Where are object.__reduce__ and object.__reduce_ex__ defined, and how
does copy_reg._reduce_ex fit into the picture? PEP 307 states that the
default __reduce__ implementation for new-style classes implemented in
Python is copy_reg._reduce. However, in  Python 2.4.3 dir(copy_reg)
indicates that it has no _reduce method. (Tangentially, is there a way
to inspect a method_descriptor object to determine the function it's
bound to?)

 - When the optional constructor argument is passed to copy_reg.pickle,
where is it stored and how is it used by pickle?

 - What does copy_reg.constructor() do?

Thanks!

--Bruce


More information about the Python-Dev mailing list