From 605fdcf754c2c3f80f71e2dc83dcb3a4e74e5d95 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 10 Apr 2018 14:39:51 +1000 Subject: [PATCH] tests/stress/recursive_gen: Add test for recursive gen with iter. --- tests/stress/recursive_gen.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/stress/recursive_gen.py b/tests/stress/recursive_gen.py index 65f5d8d470..0e0d3914ee 100644 --- a/tests/stress/recursive_gen.py +++ b/tests/stress/recursive_gen.py @@ -1,9 +1,18 @@ # test deeply recursive generators +# simple "yield from" recursion def gen(): yield from gen() - try: list(gen()) except RuntimeError: print('RuntimeError') + +# recursion via an iterator over a generator +def gen2(): + for x in gen2(): + yield x +try: + next(gen2()) +except RuntimeError: + print('RuntimeError')