mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-40847: Consider a line with only a LINECONT a blank line (GH-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 <Pablogsal@gmail.com>
(cherry picked from commit 896f4cf63f
)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
parent
18e07ba931
commit
e3ce3bba92
4 changed files with 27 additions and 1 deletions
|
@ -153,6 +153,13 @@ TEST_CASES = [
|
|||
('dict_comp', '{x:1 for x in a}'),
|
||||
('dict_comp_if', '{x:1+2 for x in a if b}'),
|
||||
('dict_empty', '{}'),
|
||||
('empty_line_after_linecont',
|
||||
r'''
|
||||
pass
|
||||
\
|
||||
|
||||
pass
|
||||
'''),
|
||||
('for',
|
||||
'''
|
||||
for i in a:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue