On Tue, 04 Sep 2012 08:57:00 -0700, Mathieu Courtois wrote:

> Here is my example :
> 
> 
> import cPickle
> 
> ParentClass = object     # works
> ParentClass = Exception  # does not
[...]
> 1. With ParentClass=object, it works as expected.
> 
> 2. With ParentClass=Exception, __getstate__/__setstate__ are not called.
> 
> Does anyone explain me why ?


I think it is a bug. According to the documentation, if your class is 
unpickleable, an exception should be raised. If it is pickleable, 
__getstate__ should be called. I can't see anything to explain that what 
you are seeing is expected behaviour.


Exceptions should definitely be pickleable:

http://bugs.python.org/issue1692335

so __getstate__ should be called. I think you should report this as a bug.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to