From: Thomas Wouters Date: Tue, 28 Mar 2006 08:14:24 +0000 (+0000) Subject: Add an example of a generator->freevar->cell->generator reference-cycle that X-Git-Tag: v2.5a0~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a33b2bc873fd5b02e02c8961a32989c83066414e;p=thirdparty%2FPython%2Fcpython.git Add an example of a generator->freevar->cell->generator reference-cycle that doesn't get cleaned up and thus leaks. --- diff --git a/Lib/test/leakers/test_generator_cycle.py b/Lib/test/leakers/test_generator_cycle.py new file mode 100644 index 000000000000..d2fa72ca8e86 --- /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() +