[New-bugs-announce] [issue17296] Cannot unpickle classes derived from 'Exception'

Andreas Hausmann report at bugs.python.org
Mon Feb 25 18:00:16 CET 2013

New submission from Andreas Hausmann:

When pickling/unpickling a class that derives from the builtin class Exception, unpickling results in a

TypeError: ('__init__() takes at least 2 arguments (1 given)', <class '__main__.TestException'>, ())

A standard exception like ValueError can be pickled/unpickled without any problem.

This was observed for versions 2.7.3 and 3.2.3. for both pickle and cPickle.

A script (cpickle) that shows that behavior is included.

This is related (but I do not quite understand how) to the closed Issue1692335.

components: Interpreter Core
files: bug_cpickle.py
messages: 182960
nosy: Andreas.Hausmann, alexandre.vassalotti, belopolsky, benjamin.peterson, bpb, brett.cannon, ehuss, facundobatista, fmitha, georg.brandl, gvanrossum, haypo, jafo, jarpa, jason.coombs, kylev, loewis, lukasz.langa, nnorwitz, pitrou, python-dev, sbt, taleinat, tseaver, zbysz, zseil
priority: normal
severity: normal
status: open
title: Cannot unpickle classes derived from 'Exception'
type: behavior
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file29234/bug_cpickle.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list