bpo-2180: Treat line continuation at EOF as a `SyntaxError` by asottile · Pull Request #13401 · python/cpython

@asottile

This makes the parser consistent with the tokenize module (already the case
in `pypy`).

sample
------

```python
x = 5\
```

before
------

```console
$ python3 t.py
$ python3 -mtokenize t.py
t.py:2:0: error: EOF in multi-line statement
```

after
-----

```console
$ ./python t.py
  File "t.py", line 3
    x = 5\

         ^
SyntaxError: unexpected EOF while parsing
$ ./python -m tokenize t.py
t.py:2:0: error: EOF in multi-line statement
```

@gpshead

gpshead

tirkarthi

@asottile

@asottile asottile deleted the continuation_at_eof_bpo-2180 branch

May 18, 2019 18:28