Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-139783: Fix inspect.getsourcelines() for the case when a decorator is followed by a comment or an empty line#139836

Merged
serhiy-storchaka merged 1 commit into
python:mainpython/cpython:mainfrom
serhiy-storchaka:inspect-getsourcelines-comment-after-decoratorserhiy-storchaka/cpython:inspect-getsourcelines-comment-after-decoratorCopy head branch name to clipboard
Oct 10, 2025
Merged

gh-139783: Fix inspect.getsourcelines() for the case when a decorator is followed by a comment or an empty line#139836
serhiy-storchaka merged 1 commit into
python:mainpython/cpython:mainfrom
serhiy-storchaka:inspect-getsourcelines-comment-after-decoratorserhiy-storchaka/cpython:inspect-getsourcelines-comment-after-decoratorCopy head branch name to clipboard

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Oct 9, 2025

Copy link
Copy Markdown
Member

…orator is followed by a comment or an empty line

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'm just curious, what's the difference between tokenize.NL and tokenize.NEWLINE?

@picnixz

picnixz commented Oct 9, 2025

Copy link
Copy Markdown
Member

See https://docs.python.org/3/library/token.html#token.NEWLINE:

Token value that indicates the end of a logical line.

and https://docs.python.org/3/library/token.html#token.NL:

Token value used to indicate a non-terminating newline. NL tokens are generated when a logical line of code is continued over multiple physical lines. The parser ignores NL tokens.

@serhiy-storchaka serhiy-storchaka merged commit f4104f5 into python:main Oct 10, 2025
51 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the inspect-getsourcelines-comment-after-decorator branch October 10, 2025 07:51
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2025
…orator is followed by a comment or an empty line (pythonGH-139836)

(cherry picked from commit f4104f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 10, 2025
…orator is followed by a comment or an empty line (pythonGH-139836)

(cherry picked from commit f4104f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app

bedevere-app Bot commented Oct 10, 2025

Copy link
Copy Markdown

GH-139889 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 10, 2025
@bedevere-app

bedevere-app Bot commented Oct 10, 2025

Copy link
Copy Markdown

GH-139890 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Oct 10, 2025
serhiy-storchaka added a commit that referenced this pull request Oct 10, 2025
…corator is followed by a comment or an empty line (GH-139836) (GH-139889)

(cherry picked from commit f4104f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Oct 10, 2025
…corator is followed by a comment or an empty line (GH-139836) (GH-139890)

(cherry picked from commit f4104f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Yhg1s pushed a commit to Yhg1s/cpython that referenced this pull request Oct 14, 2025
…n a decorator is followed by a comment or an empty line (pythonGH-139836) (pythonGH-139890)

(cherry picked from commit f4104f5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.