aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_raise.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_raise.py')
-rw-r--r--Lib/test/test_raise.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_raise.py b/Lib/test/test_raise.py
index 57da0e15a75..8dc62a933e8 100644
--- a/Lib/test/test_raise.py
+++ b/Lib/test/test_raise.py
@@ -438,6 +438,7 @@ class TestContext(unittest.TestCase):
f()
def test_3611(self):
+ import gc
# A re-raised exception in a __del__ caused the __context__
# to be cleared
class C:
@@ -451,9 +452,11 @@ class TestContext(unittest.TestCase):
x = C()
try:
try:
- x.x
+ f.x
except AttributeError:
+ # make x.__del__ trigger
del x
+ gc.collect() # For PyPy or other GCs.
raise TypeError
except Exception as e:
self.assertNotEqual(e.__context__, None)