Skip to content
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

Emit python3 prints and exception catching. #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kanaka
Copy link

@kanaka kanaka commented Feb 25, 2017

This isn't universal python3 support, but it was enough to support the python3 code I was wanting to minify.

This is necessary to support incompatible syntax between python2 and
python3 ASTs.

In addition to general utf-8/bytes/string handling, the two biggest
changes are that arguments are handled different in python3 and
integers, floats, and strings are all treated as Constant rather than
having their own class. A less significant change is that Try is now
a single class rather than two different classes for the TryExcept and
TryFinally cases.

A couple of differences that are fixed yet (expression test cases for
them are commented out in this commit):
- negative numbers in an expression are encoded as a positive number
  within a '-' unary operation.
- explicit unicode strings (starting with a u...) are not yet handled.

Also, remove the testCoding test case file since all python3 files are
UTF-8 now.
Add visit_Starred and remove specific visit_Call Starred handling since
this is covered by the new visit_Starred. Enables parsing of "[*a]"
case.
Use the stdout.buffer for writing to so that the behavior of write is to
always take bytes. Also switch the tester to use BytesIO for the
temporary write buffer for comparing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant