diff --git a/tests/functional/s/stop_iteration_inside_generator.py b/tests/functional/s/stop_iteration_inside_generator.py index 86f9187daa3..945a952bd09 100644 --- a/tests/functional/s/stop_iteration_inside_generator.py +++ b/tests/functional/s/stop_iteration_inside_generator.py @@ -154,3 +154,18 @@ def next(): it = iter(it) while True: yield next() + +def other_safeiter(it): + """Regression test for issue #7610 when ``next`` builtin is redefined""" + + def next(*things): + print(*things) + while True: + try: + return next(it) + except StopIteration: + raise + + it = iter(it) + while True: + yield next(1, 2)