diff options
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r-- | Lib/test/test_raise.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py index 4537e9a..5a63b86 100644 --- a/Lib/test/test_raise.py +++ b/Lib/test/test_raise.py @@ -324,6 +324,30 @@ class TestContext(unittest.TestCase): f() + def test_3611(self): + # A re-raised exception in a __del__ caused the __context__ + # to be cleared + class C: + def __del__(self): + try: + 1/0 + except: + raise + + def f(): + x = C() + try: + try: + x.x + except AttributeError: + del x + raise TypeError + except Exception as e: + self.assertNotEqual(e.__context__, None) + self.assert_(isinstance(e.__context__, AttributeError)) + + with support.captured_output("stderr"): + f() class TestRemovedFunctionality(unittest.TestCase): def test_tuples(self): |