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
bpo-38870: Expose a function to unparse an ast object in the ast module #17302
Conversation
CC: @isidentical |
I'm not sure if this is the right place to discuss API issues but if it isn't, I can submit a PR with these fixes to discuss. |
Lib/test/test_unparse.py
Outdated
test_dir = os.path.join(basepath, d) | ||
for n in os.listdir(test_dir): | ||
for n in os.listdir(test_dir): |
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.
IMHO using sole pathlib would be a good addition instead of mixing os.path
and pathlib
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 agree, will change this soon
…e can give preceding information for traverse
Thanks @ilevkivskyi for reviews |
…le (pythonGH-17302) Add ast.unparse() as a function in the ast module that can be used to unparse an ast.AST object and produce a string with code that would produce an equivalent ast.AST object when parsed.
Running Zac-HD/hypothesmith@98d6a7c for a while doesn't find any cases where |
Thanks for telling us, @Zac-HD :) |
I mention it because lib2to3 and tokenize both fail to round-trip for certain weird edge cases! |
…le (pythonGH-17302) Add ast.unparse() as a function in the ast module that can be used to unparse an ast.AST object and produce a string with code that would produce an equivalent ast.AST object when parsed.
https://bugs.python.org/issue38870