-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Open
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
import inspect
def source_error(*args):
frame = inspect.currentframe()
if frame is None:
return
frame = frame.f_back
if frame is None:
return
print(inspect.getsource(frame))
def demo():
loops = (
None for _ in [0] if source_error(True)
)
list(loops)
demo()
Expected output:
def demo():
loops = (
None for _ in [0] if source_error(True)
)
list(loops)
Actual output:
loops = (
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibPython modules in the Lib dirPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error