cPickle and __getattr__

Chris Curvey ccurvey at earthlink.net
Sun Aug 29 20:36:53 EDT 2004


> 
>   Potentially lots of things.  But the problem isn't that cPickle is 
> calling __getattr__, exactly.  The problem is that your __getattr__ 
> isn't properly signalling non-existent attributes.  You should raise 
> AttributeError instead of implicitly returning None for which there is 
> no attribute.  Adding "raise AttributeError(name)" to the end of the 
> definition unbreaks it enough to let pickle work.
> 

Ah, that's it.  Many thanks!




More information about the Python-list mailing list