Skip to content

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

Merged
pablogsal merged 5 commits intopython:masterfrom
lysnikolaou:linecont-blankline
Jun 10, 2020
Merged

bpo-40847: Consider a line with only a LINECONT a blank line#20769
pablogsal merged 5 commits intopython:masterfrom
lysnikolaou:linecont-blankline

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?

…47.4XAACw.rst

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
@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.

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 <Pablogsal@gmail.com>
(cherry picked from commit 896f4cf)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
@lysnikolaou lysnikolaou deleted the linecont-blankline branch June 11, 2020 09:11
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