Remove the dependency on astor for Pythons ≥ 3.9#1999
Merged
Kodiologist merged 5 commits intohylang:masterfrom Mar 17, 2021
Merged
Remove the dependency on astor for Pythons ≥ 3.9#1999Kodiologist merged 5 commits intohylang:masterfrom
Kodiologist merged 5 commits intohylang:masterfrom
Conversation
scauligi
reviewed
Mar 16, 2021
peaceamongworlds
approved these changes
Mar 16, 2021
scauligi
approved these changes
Mar 17, 2021
Member
scauligi
left a comment
There was a problem hiding this comment.
Aside from a few more small changes, lgtm
|
|
||
| if PY3_9: | ||
|
|
||
| import ast, math, cmath |
Member
There was a problem hiding this comment.
The math and cmath imports appear irrelevant.
Member
Author
There was a problem hiding this comment.
Yep, they're leftovers.
|
|
||
| import ast, math, cmath | ||
| class Unparser(ast._Unparser): | ||
| # Work around some limitations of Python's `ast.unparse`. |
Member
There was a problem hiding this comment.
Add a reference to python/cpython#24897. Since it's going to be backported to 3.9, we can eventually remove this workaround once it lands.
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
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.
Python 3.9 added
ast.unparse, which can do most of the work. It has some bugs that I fixed inastor, which I've worked around here, but I've submitted a patch to CPython to fix them for real (python/cpython#24897).