davidhalter / davidhalter/parso

Python 3.10: Parenthesized context managers

Open
#203 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
679
Forks
120
PR merge metrics
No merged PRs in 30d

Description

Besides match case, python 3.9 alpha6 / 3.10 also added parenthesized imports and context-managers.
Parenthesized imports works no problem in jedi, but parenthesized context managers lead to a syntax error:
```python
>>> import jedi
>>> source = '''
... with (
... open('/dev/stdout', 'w') as a,
... open('/dev/stdout', 'w') as b,
... ):
... a.write('a')
... b.write('b')
... '''
>>> script = jedi.Script(source, path='example.py')
>>> [print(x, x.get_message()) for x in script.get_syntax_errors()]
SyntaxError: invalid syntax
SyntaxError: invalid syntax
SyntaxError: invalid syntax
IndentationError: unexpected indent
```

See:
* https://docs.python.org/3/whatsnew/3.10.html#parenthesized-context-managers

Probably relates to:
* davidhalter/jedi#1830

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.