summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/gen_yield_from_stopped.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/gen_yield_from_stopped.py')
-rw-r--r--tests/basics/gen_yield_from_stopped.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/basics/gen_yield_from_stopped.py b/tests/basics/gen_yield_from_stopped.py
new file mode 100644
index 0000000000..468679b615
--- /dev/null
+++ b/tests/basics/gen_yield_from_stopped.py
@@ -0,0 +1,18 @@
+# Yielding from stopped generator is ok and results in None
+
+def gen():
+ return 1
+ # This yield is just to make this a generator
+ yield
+
+f = gen()
+
+def run():
+ print((yield from f))
+ print((yield from f))
+ print((yield from f))
+
+try:
+ next(run())
+except StopIteration:
+ print("StopIteration")