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.x compat, cleanup #8

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

Conversation

abarnert
Copy link

I updated the code to be Python 3-compatible; it should run under any 2.6+/3.2+.

I smoke-tested with 2.6, 2.7, 3.3, and pre-3.5 trunk with CPython, and 2.7 and 3.2 with PyPy 2.3.1.

Rather than try to fix all the mixed-str-and-bytes stuff caused by trying to work with hex strings instead of raw bytes, I changed it to use struct.pack/unpack everywhere. I believe I caught and fixed at least one bug along the way where a hex string was sent in place of the bytes it represented. But I wouldn't be too surprised if I also added at least one bug. Unfortunately, there doesn't seem to be a test suite, and I'm not sure how to stress-test it myself.

I also cleaned up the code so that it passes PEP8 (no point adding an automated PEP8 test to just ignore the warnings…), and updated check.py so that it works with PEP8 1.3 and later.

Andrew Barnert added 5 commits August 21, 2014 11:00
- Cleaned up mix of bytes and str.
- Replaced all the comparing hexlified values, etc., with struct.
- Replaced multi-arg print statements with single-arg print w/format.
- Only tested with 2.7, 3.3, and trunk (pre-3.5)
- ...although it doesn't seem to work with pep8 1.3 or later anyway...
- It was setting options the old-style way.
- The only option it was setting is deprecated.
@jtriley
Copy link
Owner

jtriley commented Nov 7, 2014

@abarnert We just merged some large project changes which most importantly includes scaffolding for a test suite, however, we still don't have enough test coverage yet. Ideally we'd have closer to full test coverage before merging this but for now we'll just have to eye-ball it and test by hand. With that said would you mind rebasing this PR against the latest develop branch? When that's done I'd like to have @Renelvon review this with me before merging. Thanks!

@Renelvon
Copy link
Collaborator

Renelvon commented Nov 7, 2014

@abarnert You don't have to worry about Python 2.6 any longer; it isn't supported as of version 0.1.0. Hope that helps you implementing Python 3.x compatibility easier.

@GF-Huang
Copy link

Could you upload you packege to PyPi (pip) ?

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.

4 participants