Skip to content

bpo-40847: Consider a line with only a LINECONT a blank line #20769

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

Merged
merged 5 commits into from
Jun 10, 2020

Conversation

lysnikolaou
Copy link
Member

@lysnikolaou lysnikolaou commented Jun 9, 2020

A line with only a line continuation character should be considered
a blank line at tokenizer level, so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a SyntaxError for valid input. For example,
an empty line following a line continuation character was interpreted
as a SyntaxError.

https://bugs.python.org/issue40847

A line with only a line continuation character should be considered
a blank line at tokenizer level, so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.
@lysnikolaou
Copy link
Member Author

Should we also backport this to the other bug-fix branches?

@gvanrossum
Copy link
Member

Only to 3.9. Who knows what else it breaks...

Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

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

LGTM

@lysnikolaou
Copy link
Member Author

@pablogsal I didn't like the blurb text before, so I changed it up a bit. Could you review it once more, please?

@pablogsal pablogsal merged commit 896f4cf into python:master Jun 10, 2020
@miss-islington
Copy link
Contributor

Thanks @lysnikolaou for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-20795 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Jun 10, 2020
miss-islington added a commit that referenced this pull request Jun 11, 2020
A line with only a line continuation character should be considered
a blank line at tokenizer level so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.

Co-authored-by: Pablo Galindo <[email protected]>
(cherry picked from commit 896f4cf)

Co-authored-by: Lysandros Nikolaou <[email protected]>
@lysnikolaou lysnikolaou deleted the linecont-blankline branch June 11, 2020 09:11
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 2020
…H-20769)

A line with only a line continuation character should be considered
a blank line at tokenizer level so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.

Co-authored-by: Pablo Galindo <[email protected]>
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.

6 participants