Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-105435: Fix spurious NEWLINE token if file ends with comment without a newline #105442

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Jun 7, 2023

@pablogsal
Copy link
Member Author

>>> tokenize.untokenize(tokenize.generate_tokens(io.StringIO('a\n ').readline))
'a\n '
>>> tokenize.untokenize(tokenize.generate_tokens(io.StringIO('#').readline))
'#'

Copy link
Contributor

@mgmacias95 mgmacias95 left a comment

Choose a reason for hiding this comment

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

LGTM

@pablogsal pablogsal merged commit 7279fb6 into python:main Jun 7, 2023
@pablogsal pablogsal deleted the gh-105435 branch June 7, 2023 12:31
@miss-islington
Copy link
Contributor

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 7, 2023
… without a newline (pythonGH-105442)

(cherry picked from commit 7279fb6)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
@bedevere-bot
Copy link

GH-105444 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Jun 7, 2023
pablogsal pushed a commit that referenced this pull request Jun 7, 2023
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.

4 participants