[Python-checkins] r43386 - python/trunk/Lib/test/leakers/test_generator_cycle.py

thomas.wouters python-checkins at python.org
Tue Mar 28 10:14:24 CEST 2006


Author: thomas.wouters
Date: Tue Mar 28 10:14:24 2006
New Revision: 43386

Added:
   python/trunk/Lib/test/leakers/test_generator_cycle.py
Log:

Add an example of a generator->freevar->cell->generator reference-cycle that
doesn't get cleaned up and thus leaks.



Added: python/trunk/Lib/test/leakers/test_generator_cycle.py
==============================================================================
--- (empty file)
+++ python/trunk/Lib/test/leakers/test_generator_cycle.py	Tue Mar 28 10:14:24 2006
@@ -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()
+


More information about the Python-checkins mailing list