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

Python 3 compatibility #12

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

Conversation

natebragg
Copy link
Collaborator

Done in stages, to help make clear the nature of each change.

I tested with:

python -m test.test_mini
python -m test.test_new_ast
python -m test.test_java
python -m test.test_java_precisely

Then I did the same with python3, and then compared the output.

The specific versions tested were 2.7.15rc1 and 3.6.7.

@natebragg
Copy link
Collaborator Author

With these last few changes, I have now also verified it against all the tests in test_axioms (or at least the ones that were passing before).

@natebragg natebragg force-pushed the py3port branch 2 times, most recently from ba1d5c4 to 599a295 Compare May 1, 2019 18:28
natebragg added 12 commits May 15, 2019 17:29
This code seems to rely pretty heavily on nuances of string encodings, and
without being sure of exactly how, it seems safer just to work around it.
Turns out this was necessary after all, because python 3 map and filter return
iterators, not lists.
The `universal_newlines` flag is ignored by python 2, but without it, python 3
yields a bytestring here, which is a monkey wrench in whatever uses the result.

The call to "zip" in python 3 yields an iterator, which can only be consumed
once, and isn't memoized, so the subsequent uses of `cls` fail to do anything.
Avoiding name shadowing, iterating a changing structure, and concatenating
dictionaries.
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