This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lys.nikolaou
Recipients adamwill, benjamin.peterson, brett.cannon, christian.heimes, gvanrossum, lys.nikolaou, pablogsal, yselivanov
Date 2020-06-06.01:23:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591406608.76.0.487669257421.issue40847@roundup.psfhosted.org>
In-reply-to
Content
This is limited to cases where the line continuation character is on an otherwise empty line. For example this works correctly:

$ cat t.py
print("hello world")
print("hello world 2") \

print("hello world 3")
$ ./python.exe t.py
hello world
hello world 2
hello world 3

The actual problem is at the tokenizer level, where a line with only a continuation character is not considered an empty line and thus two NEWLINE tokens get emitted, one after the other. The old parser was somehow working around this, probably by having this in the grammar:

file_input: (NEWLINE | stmt)* ENDMARKER

The PEG parser OTOH does not allow this.

The question now is, is it reasonable to change the tokenizer to consider a lone backslash an empty line? Do you also consider this a bug? Or should we change the new parser?
History
Date User Action Args
2020-06-06 01:23:28lys.nikolaousetrecipients: + lys.nikolaou, gvanrossum, brett.cannon, christian.heimes, benjamin.peterson, yselivanov, adamwill, pablogsal
2020-06-06 01:23:28lys.nikolaousetmessageid: <1591406608.76.0.487669257421.issue40847@roundup.psfhosted.org>
2020-06-06 01:23:28lys.nikolaoulinkissue40847 messages
2020-06-06 01:23:28lys.nikolaoucreate