Skip to content

Emit python3 prints and exception catching.#55

Open
kanaka wants to merge 5 commits into
gareth-rees:masterfrom
kanaka:master
Open

Emit python3 prints and exception catching.#55
kanaka wants to merge 5 commits into
gareth-rees:masterfrom
kanaka:master

Conversation

@kanaka

@kanaka kanaka commented Feb 25, 2017

Copy link
Copy Markdown

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