Issue 36091: clean up async generator from types module (original) (raw)

the following script:

import sys, types

def tr(frame, event, arg):
    print(frame, event, arg)
    return tr

sys.settrace(tr)

gives the output:

<frame object at 0x106c5cd48> call None
<frame object at 0x106c5cd48> exception (<class 'GeneratorExit'>, GeneratorExit(), <traceback object at 0x106cc1f88>)
<frame object at 0x106c5cd48> return None

This is due to Lib/types.py creating an async generator for the sole purpose of getting its type. I'll remove that reference after use to prevent the above message, which is probably benign but perhaps unnerving.