summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-11 00:14:16 (GMT)
committerGitHub <noreply@github.com>2020-06-11 00:14:16 (GMT)
commite3ce3bba9277a7c4cfde5aaf6269b6c68f334176 (patch)
treee5fcc2e35df0773ae91ae0a9e4aac56110476d4b /Misc
parent18e07ba931c68eb5ab5262d4e57fe58c302686de (diff)
downloadcpython-e3ce3bba9277a7c4cfde5aaf6269b6c68f334176.zip
cpython-e3ce3bba9277a7c4cfde5aaf6269b6c68f334176.tar.gz
cpython-e3ce3bba9277a7c4cfde5aaf6269b6c68f334176.tar.bz2
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 896f4cf63f9ab93e30572d879a5719d5aa2499fb) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2020-06-09-23-52-32.bpo-40847.4XAACw.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-09-23-52-32.bpo-40847.4XAACw.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-09-23-52-32.bpo-40847.4XAACw.rst
new file mode 100644
index 0000000..0b489f2
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-09-23-52-32.bpo-40847.4XAACw.rst
@@ -0,0 +1,4 @@
+Fix a bug where a line with only a line continuation character is not considered a blank line at tokenizer level.
+In such cases, more than a single `NEWLINE` token was emitted. The old parser was working around the issue,
+but the new parser threw a :exc:`SyntaxError` for valid input due to this. For example, an empty line following
+a line continuation character was interpreted as a :exc:`SyntaxError`.