[issue1692335] Fix exception pickling: Move initial args assignment to BaseException.__new__

Eric Huss report at bugs.python.org
Wed Nov 19 00:07:22 CET 2008


Eric Huss <eric at huss.org> added the comment:

In the attached test_exception_pickle.py file, class C and D cannot be
unpickled (raises TypeError).

class C(Exception):
    """Extension with values, args not set."""
    def __init__(self, foo):
        self.foo = foo

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

There are also some other exceptions that fail to be handled properly. 
See the exception_pickling_26.diff for some unittests.  In particular, I
see SlotedNaiveException failing.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1692335>
_______________________________________


More information about the Python-bugs-list mailing list