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

parso can't parse PEP 695: Type Parameter Syntax #221

Open
heavenshell opened this issue Dec 23, 2023 · 0 comments
Open

parso can't parse PEP 695: Type Parameter Syntax #221

heavenshell opened this issue Dec 23, 2023 · 0 comments

Comments

@heavenshell
Copy link

Hi, first of all thank you for creating awesome library.
I'm useing parso in my library.

Python3.12 has big change at grammer.
https://docs.python.org/3/whatsnew/3.12.html#whatsnew312-pep695

parso does not support PEP 695: Type Parameter Syntax.

import parso

code = """def func[T](arg1: T, arg2: T) -> T:
    return arg1 + arg2"""

module = parso.parse(code, version='3.12')
expr = module.children[0]
print(expr) 
print(expr.get_code()) 

output

<PythonErrorNode: def func@1,0>
def func

This example is def, but classes may be similar.

It would be very helpful if you could support the new grammar.
Thank you.

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

1 participant