-
Notifications
You must be signed in to change notification settings - Fork 164
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
Python 3.9 ast changes #333
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 97a1a57137e075ee00879ee663e057f7e3c78147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@cepl.eu>
Date: Mon, 15 Mar 2021 22:06:35 +0100
Subject: [PATCH rope] Test for Python 3.9 as well
---
.github/workflows/main.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 229dd195..eef68621 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
- python-version: [2.7, 3.5, 3.6, 3.7, 3.8]
+ python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
--
2.30.2
|
Done and Done (I see "Allow edits by maintainers" checked) |
Fixes the following two tests under Python 3.9: FAILED ropetest/refactor/patchedasttest.py::PatchedASTTest::test_ext_slice_node - AssertionError: Node <ExtSlice> cannot be found FAILED ropetest/refactor/patchedasttest.py::PatchedASTTest::test_simple_subscript - AssertionError: False is not true : Expected <Index> but was <Constant> The ast module in Python 3.9 has some API changes. Quoting [1]: Simplified AST for subscription. Simple indices will be represented by their value, extended slices will be represented as tuples. Index(value) will return a value itself, ExtSlice(slices) will return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in bpo-34822.) [1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api
The ast module in Python 3.9 has some API changes. Quoting [1]: Simplified AST for subscription. Simple indices will be represented by their value, extended slices will be represented as tuples. Index(value) will return a value itself, ExtSlice(slices) will return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in bpo-34822.) [1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api isinstance(thing, ast.Index) always return false in Python >= 3.9, so we need to handle... whatever the value is now. ast.expr catches 20 of the remaining 24 failures. The remaining 4 are resolved in the next patch. Fixes: #299
The ast module in Python 3.9 has some API changes. Quoting [1]: Simplified AST for subscription. Simple indices will be represented by their value, extended slices will be represented as tuples. Index(value) will return a value itself, ExtSlice(slices) will return Tuple(slices, Load()). (Contributed by Serhiy Storchaka in bpo-34822.) [1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api This fixes the remaining 4 failures under Python 3.9. FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_append_function FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_for_loops FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_dicts_depending_on_update FAILED ropetest/advanced_oi_test.py::NewStaticOITest::test_static_oi_for_lists_per_object_for_set_item Fixes: #299
Okay. I fixed the remaining four failures. I feel like I'm just banging on it with a hammer until it works, so someone please review. :) |
Thank you, thank you, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The ast module in Python 3.9 has some API changes. Quoting [1]:
The second patch is still a work-in-progress, for two reasons: I don't know if the bit I added is functionally correct (though it resolves 20/24 of the test failures), and I don't know how to handle
ast.Call
(and potentially anything else) that seems to be the cause of the remaining 4 failures.Help required.
[1] https://docs.python.org/3/whatsnew/3.9.html#changes-in-the-python-api