Instagram / Instagram/LibCST

ParserSyntaxError for "unmatched ']'" faults wrong location

Open
#1,112 1 comment 0 reactions 0 assignees View on GitHub
enhancement parsing
Dominant language
Python
Stars
1.9k
Forks
229
PR merge metrics
No merged PRs in 30d

Description

I suspect this is an upstream issue, but documenting the repro so we can know if it gets fixed:

```
"""docstring"""
import a
import b
def foo(data: str) -> tuple[str, ...], frozenset[str]]:
pass
```

(note too many close brackets at the end of the def line)

```
libcst._exceptions.ParserSyntaxError: Syntax Error @ 1:1.
tokenizer error: unmatched ']'

"""docstring"""
^
```

faults the first line of the file, when there is clearly one specific byte that can be faulted -- the extra close bracket.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.