Visitar URL original
Recent changes to CPython's grammar and PEG parser, PEP-617 · Issue #2759 · RustPython/RustPython · GitHub
The Wayback Machine - https://web.archive.org/web/20221229100759/https://github.com/RustPython/RustPython/issues/2759
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent changes to CPython's grammar and PEG parser, PEP-617 #2759

Open
sobolevn opened this issue Jul 29, 2021 · 10 comments
Open

Recent changes to CPython's grammar and PEG parser, PEP-617 #2759

sobolevn opened this issue Jul 29, 2021 · 10 comments

Comments

@sobolevn
Copy link
Contributor

sobolevn commented Jul 29, 2021 •

Feature

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'

But, RustPython does not support it:
Снимок экрана 2021-07-29 в 12 54 24

I think that the root of this problem is that new PEG parser is not supported: https://github.com/RustPython/RustPython/blob/master/parser/src/python.lalrpop

Python Documentation

https://www.python.org/dev/peps/pep-0617/

@DimitrisJim
Copy link
Member

DimitrisJim commented 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
Copy link
Contributor Author

sobolevn commented Jul 29, 2021

Then, I guess we can change this line in the README, because 3.9>=3.8 🙂
Снимок экрана 2021-07-29 в 19 09 31

@sobolevn
Copy link
Contributor Author

sobolevn commented Jul 29, 2021

Also: #2417

@youknowone
Copy link
Member

youknowone commented Aug 4, 2021

I think we are practically not pinning a target. Any patch for 3.9+ features will be appreciated.

@fanninpm
Copy link
Contributor

fanninpm commented Aug 10, 2021

I believe 3.8 is the absolute minimum because it's referenced in .github/workflows/ci.yaml.

@youknowone
Copy link
Member

youknowone commented Aug 10, 2021

we just can change it to 3.9 once we feel it is more convenient. that happened a few times.

@youknowone
Copy link
Member

youknowone commented Aug 11, 2021

#2831

@sobolevn
Copy link
Contributor Author

sobolevn commented Aug 11, 2021

@youknowone youknowone pinned this issue Dec 10, 2022
@youknowone
Copy link
Member

youknowone commented Dec 10, 2022

We'd better to rewrite our parser based on same parser definition with CPython.

@youknowone
Copy link
Member

youknowone commented Dec 12, 2022

see also: charliermarsh/ruff#286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants