Skip to content

Updates to support python 3.9 AST#2225

Merged
fubuloubu merged 3 commits into
vyperlang:masterfrom
iamdefinitelyahuman:feat-python-39
Nov 27, 2020
Merged

Updates to support python 3.9 AST#2225
fubuloubu merged 3 commits into
vyperlang:masterfrom
iamdefinitelyahuman:feat-python-39

Conversation

@iamdefinitelyahuman

@iamdefinitelyahuman iamdefinitelyahuman commented Nov 26, 2020

Copy link
Copy Markdown
Contributor

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: ApeWorX/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