[issue5370] unpickling vs. __getattr__

Gabriel Genellina report at bugs.python.org
Sat Mar 14 01:28:07 CET 2009


Gabriel Genellina <gagsl-py2 at yahoo.com.ar> added the comment:

I think that trying to emulate all "getattr" details in the middle of 
unpickling (but omiting calls to __getattr__) isn't the right thing to 
do. What if in some cases __getattr__ (or __getattribute__) *does* the 
right thing, but pickle doesn't call it? Other people would be 
rightfully upset.

There should be a warning note about __getattr__ in the pickle 
documentation, and people should be encouraged to write __getattr__ in 
a more robust way, if class instances are meant to be pickled.

----------

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


More information about the Python-bugs-list mailing list