You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recent changes to CPython's grammar and PEG parser, PEP-617 #2759
CPython3.9+ support some new grammar rules, like () around with expression:
» python3.9 --version
Python 3.9.4
» python3.9
Python 3.9.4 (default, Apr 5 2021, 01:47:16)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> with (open('a') as f):
... print(f)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'a'
Yup, the project is currently targeting 3.8 so this shouldn't come as a surprise. Hopefully, at some point in the future, 3.9 will be the new goal and using a PEG parser will probably be needed.
Parenthesized `with` (PEP 617) works on current main, e.g. `with (open("/dev/null") as f):` and multi-context parenthesized `with`. The parser is no longer the old LL parser. Closing.
Activity
DimitrisJim commentedon Jul 29, 2021
Yup, the project is currently targeting 3.8 so this shouldn't come as a surprise. Hopefully, at some point in the future, 3.9 will be the new goal and using a PEG parser will probably be needed.
sobolevn commentedon Jul 29, 2021
Then, I guess we can change this line in the README, because

3.9>=3.8🙂sobolevn commentedon Jul 29, 2021
Also: #2417
youknowone commentedon Aug 4, 2021
I think we are practically not pinning a target. Any patch for 3.9+ features will be appreciated.
fanninpm commentedon Aug 10, 2021
I believe 3.8 is the absolute minimum because it's referenced in
.github/workflows/ci.yaml.youknowone commentedon Aug 10, 2021
we just can change it to 3.9 once we feel it is more convenient. that happened a few times.
youknowone commentedon Aug 11, 2021
#2831
sobolevn commentedon Aug 11, 2021
Related https://github.com/zsol/LibCST/blob/parser/native/libcst_parser/src/grammar.rs
youknowone commentedon Dec 10, 2022
We'd better to rewrite our parser based on same parser definition with CPython.
youknowone commentedon Dec 12, 2022
see also: astral-sh/ruff#286
youknowone commentedon Oct 6, 2026
Parenthesized `with` (PEP 617) works on current main, e.g. `with (open("/dev/null") as f):` and multi-context parenthesized `with`. The parser is no longer the old LL parser. Closing.
— commented by Grok 4.6