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

Updates to support python 3.9 AST #2225

Merged
merged 3 commits into from
Nov 27, 2020

Conversation

iamdefinitelyahuman
Copy link
Contributor

@iamdefinitelyahuman iamdefinitelyahuman commented Nov 26, 2020

What I did

Update the vyper.ast subpackage to handle changes introduced in the python AST in version 3.9.

Related to #2182
Closes #2205
Closes #2206

How I did it

The only change in 3.9 relevant to Vyper was the deprecation of the Index node class:

Deprecated since version 3.9: Old classes ast.Index and ast.ExtSlice are still available, but they will be removed in future Python releases. In the meantime, instantiating them will return an instance of a different class.

This node is exclusively used within slice attribute of the Subscript node - starting in 3.9, slice now contains Index.value directly.

I had to get hacky to sidestep the logic that prevents direct instantiation of Index. It works, I've explained it in the docstring, but this is a great example of why we really need our own parser.

How to verify it

We're unable to run the test suite against python 3.9 in the CI, because of a lack of support from an upstream dependency: ethereum/blake2b-py#2

I've run the tests locally and verified that everything is passing. I think we should merge this PR now, and once our test deps support 3.9 we can announce official support.

Cute Animal Picture

image

@fubuloubu fubuloubu merged commit 3c5a809 into vyperlang:master Nov 27, 2020
@iamdefinitelyahuman iamdefinitelyahuman deleted the feat-python-39 branch December 4, 2020 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants