Why derivated exception can not be pickled ?

Mathieu Courtois mathieu.courtois at gmail.com
Wed Sep 5 04:54:21 EDT 2012


Thanks for your reply


On Wednesday, September 5, 2012 8:02:55 AM UTC+2, Dieter Maurer wrote:
> 
> The pickle interface is actually more complex and there are several
> 
> ways an object can ensure picklability. For example, there is
> 
> also a "__reduce__" method. I suppose, that "Exception" defines methods
> 
> which trigger the use of an alternative picklability approach (different
> 
> from "__getstate__/__setstate__").

You're right: Exception has __reduce__ & __reduce_ex__ methods. Always read carefully the manual ;-)

I must override these methods.


MC



More information about the Python-list mailing list