-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-39999: Improve compatibility of the ast module. #19056
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
30f4132
bpo-39999: Imporove compatibility of the ast module.
serhiy-storchaka 48fab9e
Merge branch 'master' into ast-classes
serhiy-storchaka 8a06315
Update documentation.
serhiy-storchaka 07fc0b2
Re-add ast.slice.
serhiy-storchaka 9e874a7
Refactor docstrings for properties.
serhiy-storchaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
1 change: 0 additions & 1 deletion
1
Misc/NEWS.d/next/Core and Builtins/2020-02-15-15-29-34.bpo-39639.3mqJjm.rst
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2020-02-15-15-29-34.bpo-39639.3mqJjm.rst
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Deprecated ``ast.Suite`` node class because it's no longer used. Patch by Batuhan Taskaya. |
2 changes: 1 addition & 1 deletion
2
Misc/NEWS.d/next/Library/2020-03-15-17-56-48.bpo-39969.6snm0c.rst
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Remove ``ast.Param`` node class because it's no longer used. Patch by | ||
Deprecated ``ast.Param`` node class because it's no longer used. Patch by | ||
Batuhan Taskaya. |
2 changes: 1 addition & 1 deletion
2
Misc/NEWS.d/next/Library/2020-03-17-09-35-00.bpo-39988.kXGl35.rst
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Removed ``ast.AugLoad`` and ``ast.AugStore`` node classes because they are | ||
Deprecated ``ast.AugLoad`` and ``ast.AugStore`` node classes because they are | ||
no longer used. |
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2020-03-18-11-50-25.bpo-39999.8aOXDT.rst
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
``__module__`` of the AST node classes is now set to "ast" instead of | ||
"_ast". Added docstrings for dummy AST node classes and deprecated | ||
attributes. |
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@serhiy-storchaka what do you think about implementing custom instance and subclass checks for
slice
?slice
is a sum type, so there should be checks like thisissubclass(thing, ast.slice)
orisinstance(thing, ast.slice)
something like this should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
Slice
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before the simplification, it was part of
slice
kind. Now it is an expression by it is own but if we want to increase compatibility, wouldn't it better to it behave like a subclass ofast.slice
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it would be useful because
Index()
can return arbitrary node type and it is impossible to distinguishExtSlice
fromTuple
.