summaryrefslogtreecommitdiff
path: root/Lib/test/test_pep380.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pep380.py')
-rw-r--r--Lib/test/test_pep380.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_pep380.py b/Lib/test/test_pep380.py
index 658bcb99c1..9569e10c9e 100644
--- a/Lib/test/test_pep380.py
+++ b/Lib/test/test_pep380.py
@@ -940,6 +940,20 @@ class TestPEP380Operation(unittest.TestCase):
for stack in spam(eggs(gen())):
self.assertTrue('spam' in stack and 'eggs' in stack)
+ def test_custom_iterator_return(self):
+ # See issue #15568
+ class MyIter:
+ def __iter__(self):
+ return self
+ def __next__(self):
+ raise StopIteration(42)
+ def gen():
+ nonlocal ret
+ ret = yield from MyIter()
+ ret = None
+ list(gen())
+ self.assertEqual(ret, 42)
+
def test_main():
from test import support