diff options
Diffstat (limited to 'Lib/test/test_scope.py')
-rw-r--r-- | Lib/test/test_scope.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_scope.py b/Lib/test/test_scope.py index db88dbd..cd2d98c 100644 --- a/Lib/test/test_scope.py +++ b/Lib/test/test_scope.py @@ -597,6 +597,24 @@ self.assert_(X.passed) f(4)() + def testFreeingCell(self): + # Test what happens when a finalizer accesses + # the cell where the object was stored. + class Special: + def __del__(self): + nestedcell_get() + + def f(): + global nestedcell_get + def nestedcell_get(): + return c + + c = (Special(),) + c = 2 + + f() # used to crash the interpreter... + + def test_main(): run_unittest(ScopeTests) |