diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-28 08:14:24 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-28 08:14:24 (GMT) |
commit | a33b2bc873fd5b02e02c8961a32989c83066414e (patch) | |
tree | f8b318146ae25bd354b9779f52b7dc19a86b5efb /Lib/test | |
parent | 96c3f7f56bcbb1db26d0b09cfe17b89dd032a813 (diff) | |
download | cpython-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.py | 11 |
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() + |