diff -r 1eaf65d17c15 -r 053a434e36ce Lib/test/pickletester.py --- a/Lib/test/pickletester.py Mon May 31 19:01:01 2010 +0200 +++ b/Lib/test/pickletester.py Mon May 31 17:11:19 2010 -0400 @@ -1036,6 +1036,17 @@ MyStr, MyUnicode, MyTuple, MyList, MyDict] +class MyException(Exception): + """Extension with values, args not set.""" + def __init__(self, foo): + self.foo = foo + +class MyException2(Exception): + """Extension with values, init called with no args.""" + def __init__(self, foo): + self.foo = foo + Exception.__init__(self) + class SlotList(MyList): __slots__ = ["foo"] @@ -1110,6 +1121,16 @@ self.assertRaises((IndexError, cPickle.UnpicklingError), self.module.loads, s) + def test_unpickle_exceptions_requiring_args(self): + # Test issue1692335 + c = MyException('testing') + c2 = self.module.loads(self.module.dumps(c)) + self.assertEqual(c2.foo, c.foo) + d = MyException2('testing') + d2 = self.module.loads(self.module.dumps(d)) + self.assertEqual(d2.foo, d.foo) + + class AbstractPersistentPicklerTests(unittest.TestCase): # This class defines persistent_id() and persistent_load()