summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
diff options
context:
space:
mode:
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-07-12 13:25:53 (GMT)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>2001-07-12 13:25:53 (GMT)
commit88c761a117c42577378fca88dad5881418dbbf3c (patch)
treefa57bd726e4f1faabbae74aa32b7304394d0d65f /Lib/test/test_gc.py
parent28358fbed62e06bddf8934a591e9c09d91bd2024 (diff)
downloadcpython-88c761a117c42577378fca88dad5881418dbbf3c.zip
cpython-88c761a117c42577378fca88dad5881418dbbf3c.tar.gz
cpython-88c761a117c42577378fca88dad5881418dbbf3c.tar.bz2
Test GC of frame objects.
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r--Lib/test/test_gc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 1c008be..cc74374 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,4 +1,5 @@
from test_support import verify, verbose, TestFailed
+import sys
import gc
def run_test(name, thunk):
@@ -107,6 +108,15 @@ def test_function():
if gc.collect() != 2:
raise TestFailed
+def test_frame():
+ def f():
+ frame = sys._getframe()
+ gc.collect()
+ f()
+ if gc.collect() != 1:
+ raise TestFailed
+
+
def test_saveall():
# Verify that cyclic garbage like lists show up in gc.garbage if the
# SAVEALL option is enabled.
@@ -152,6 +162,7 @@ def test_all():
run_test("instances", test_instance)
run_test("methods", test_method)
run_test("functions", test_function)
+ run_test("frames", test_frame)
run_test("finalizers", test_finalizer)
run_test("__del__", test_del)
run_test("saveall", test_saveall)