-
-
Couldn't load subscription status.
- Fork 33.3k
Closed as duplicate of#139783
Closed as duplicate of#139783
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
It seems that 3.13.8 introduced a breaking change in how inspect.getsourcelines handles comments between a decorator and the function being decorated
Minimal reproducer:
import inspect
def decorate(func):
return func
@decorate
# harmless comment
def spam() -> None:
pass
print(inspect.getsourcelines(spam))output with 3.13.7:
(['@decorate\n', 'def spam() -> None:\n', ' pass\n'], 7)
output with 3.13.8 (the pass line is missing):
(['@decorate\n', '# harmless comment\n', 'def spam() -> None:\n'], 6)
there's also a difference in the line number for some reason
CPython versions tested on:
3.13
Operating systems tested on:
Linux
czardoz
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error