Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28468

Re: Why derivated exception can not be pickled ?

Newsgroups comp.lang.python
Date 2012-09-05 01:54 -0700
References <7bb72fb5-5ab5-4748-acbf-c8e7666ee834@googlegroups.com> <mailman.211.1346824947.27098.python-list@python.org>
Message-ID <f8fdaa79-5a58-4738-b18a-1df3f47abcba@googlegroups.com> (permalink)
Subject Re: Why derivated exception can not be pickled ?
From Mathieu Courtois <mathieu.courtois@gmail.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-04 08:57 -0700
  Re: Why derivated exception can not be pickled ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-09-05 00:34 +0000
  Re: Why derivated exception can not be pickled ? Dieter Maurer <dieter@handshake.de> - 2012-09-05 08:02 +0200
    Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 01:54 -0700
    Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 01:54 -0700
  Re: Why derivated exception can not be pickled ? Mathieu Courtois <mathieu.courtois@gmail.com> - 2012-09-05 03:18 -0700

csiph-web