`ParserSyntaxError` on `from foo import (bar \n as baz)`
Open
bug
parsing
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
```python
import libcst as cst
code = """
from math import (nan
as NaN)
"""
compile(code, "", "exec") # (no error)
cst.parse_module(code) # ParserSyntaxError: Syntax Error @ 4:9.
# Internal error: There must be at least one space before 'as'.
```
While this is really weird code, it does actually happen in the wild, e.g. [here](https://bitbucket.org/mrabarnett/mrab-regex/src/d81009be6985efda7a533d767901f6ba192b7b71/regex_3/regex.py#lines-428:429) in the [`regex` package](https://pypi.org/project/regex/).
Contributor guide
Assessment
This issue has not been assessed yet.