This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xxm
Recipients xxm
Date 2020-12-28.04:38:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1609130295.32.0.912620547313.issue42762@roundup.psfhosted.org>
In-reply-to
Content
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)
......
----------------------------------------------------------------------
History
Date User Action Args
2020-12-28 04:38:15xxmsetrecipients: + xxm
2020-12-28 04:38:15xxmsetmessageid: <1609130295.32.0.912620547313.issue42762@roundup.psfhosted.org>
2020-12-28 04:38:15xxmlinkissue42762 messages
2020-12-28 04:38:15xxmcreate