Updates to support python 3.9 AST #2225
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:This node is exclusively used within
slice
attribute of theSubscript
node - starting in 3.9,slice
now containsIndex.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