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
Bug report
Bug description:
It seems that 3.13.8 introduced a breaking change in how
inspect.getsourcelineshandles comments between a decorator and the function being decoratedMinimal reproducer:
output with 3.13.7:
output with 3.13.8 (the
passline is missing):there's also a difference in the line number for some reason
CPython versions tested on:
3.13
Operating systems tested on:
Linux