summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2006-03-28 08:14:24 (GMT)
committerThomas Wouters <thomas@python.org>2006-03-28 08:14:24 (GMT)
commita33b2bc873fd5b02e02c8961a32989c83066414e (patch)
treef8b318146ae25bd354b9779f52b7dc19a86b5efb /Lib/test
parent96c3f7f56bcbb1db26d0b09cfe17b89dd032a813 (diff)
downloadcpython-a33b2bc873fd5b02e02c8961a32989c83066414e.zip
cpython-a33b2bc873fd5b02e02c8961a32989c83066414e.tar.gz
cpython-a33b2bc873fd5b02e02c8961a32989c83066414e.tar.bz2
Add an example of a generator->freevar->cell->generator reference-cycle that
doesn't get cleaned up and thus leaks.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/leakers/test_generator_cycle.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/leakers/test_generator_cycle.py b/Lib/test/leakers/test_generator_cycle.py
new file mode 100644
index 0000000..d2fa72c
--- /dev/null
+++ b/Lib/test/leakers/test_generator_cycle.py
@@ -0,0 +1,11 @@
+
+# This leaks since the introduction of yield-expr and the use of generators
+# as coroutines, trunk revision 39239. The cycle-GC doesn't seem to pick up
+# the cycle, or decides it can't clean it up.
+
+def leak():
+ def gen():
+ while True:
+ yield g
+ g = gen()
+