New submission from Xinmeng Xia <xi...@smail.nju.edu.cn>:
Let's see the following program: ============================ def foo(): try: yield except: yield from foo() for m in foo(): print(i) =========================== Expected output: On line"print(i)", NameError: name 'i' is not defined However, the program will fall into infinite loops when running it on Python 3.7-3.10 with the error messages like the following.(no infinite loop on Python 3.5 and Python 3.6) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/xxm/Desktop/nameChanging/report/test1.py", line 160, in <module> print(i) RuntimeError: generator ignored GeneratorExit Exception ignored in: <generator object foo at 0x7fb30ff639e0> Traceback (most recent call last): File "/home/xxm/Desktop/nameChanging/report/test1.py", line 160, in <module> print(i) RuntimeError: generator ignored GeneratorExit Exception ignored in: <generator object foo at 0x7fb30ff63a50> Traceback (most recent call last): File "/home/xxm/Desktop/nameChanging/report/test1.py", line 160, in <module> print(i) RuntimeError: generator ignored GeneratorExit Exception ignored in: <generator object foo at 0x7fb30ff63ac0> Traceback (most recent call last): File "/home/xxm/Desktop/nameChanging/report/test1.py", line 160, in <module> print(i) ...... ---------------------------------------------------------------------- ---------- components: Interpreter Core messages: 383882 nosy: xxm priority: normal severity: normal status: open title: infinite loop resulted by "yield" type: crash versions: Python 3.10, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42762> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com