This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients alexandre.vassalotti, belopolsky, brett.cannon, ehuss, facundobatista, georg.brandl, gvanrossum, jafo, jarpa, kylev, loewis, nnorwitz, tseaver, zseil
Date 2010-06-29.22:18:58
SpamBayes Score 8.3540806e-07
Marked as misclassified No
Message-id <1277849940.54.0.562826161307.issue1692335@psf.upfronthosting.co.za>
In-reply-to
Content
The case in msg76028 are probably not pointing to a bug.  If subclass' __init__ passes its args to the base class __init__ (as it probably should), pickling works: 

class E(Exception):
    """Extension with values, init called with args."""
    def __init__(self, foo):
        self.foo = foo
        Exception.__init__(self, foo)

>>> from pickle import *
>>> loads(dumps(E(1)))
E(1,)
>>> _.foo
1

What would be a use case for not setting args?  Even if there was a valid use case for it, it would be easy to simply provide custom __getinitargs__ or __reduce__ to support it.

Note that with msg76028 definitions, eval(repr(C('foo'))) also raises a TypeError, so properly supporting args hiding in exception subclasses would probably involve overriding __repr__ as well.
History
Date User Action Args
2010-06-29 22:19:01belopolskysetrecipients: + belopolsky, gvanrossum, loewis, nnorwitz, brett.cannon, georg.brandl, facundobatista, jafo, ehuss, tseaver, zseil, alexandre.vassalotti, jarpa, kylev
2010-06-29 22:19:00belopolskysetmessageid: <1277849940.54.0.562826161307.issue1692335@psf.upfronthosting.co.za>
2010-06-29 22:18:58belopolskylinkissue1692335 messages
2010-06-29 22:18:58belopolskycreate