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
Support Python 3 #56
Support Python 3 #56
Conversation
These are mostly unicode string related changes and a few syntax ones. oauthlib#55
Uh. I seemed to have created a new issue, sorry. I'm not super familiar with github. |
OK, I've fixed 2.6 support. You shouldn't need Six. The difficulty of this port was mostly changing from Python2's bytes-by-default to Python3's unicode-by-default. Six won't really help with that (though it does give you u() and b() functions as syntactic sugar). I did mimic Six's unicode_type and bytes_type in common.py though. I'd appreciate a review of this branch, it's ready now. I'll close out the other issue, since this one has the code. |
Great work! Will try and look into this during the weekend if none beats me to it. |
FYI, I pushed this patch to Ubuntu. So it should be getting some real world testing. |
Sorry for taking ages to get to this. I had a look this morning and found some minor unittest glitches in 3.1 and 3.3, the former lacking assertIsInstance and the latter making string comparisons based on dict ordering invalid (yea our tests needs some love). Will try and sort that out tonight. 2.6, 2.7 and 3.2 =) |
Thanks once again for this! I've monkey patched in assertIsInstance into TestCase for 3.1 and the 3.3 issues are in #62. |
These are mostly unicode string related changes and a few syntax ones. The diff is a bear to read because of all the minor u's' -> 's' changes. :(
#55
Tests pass under both Python2.7 and Python3.2. I don't happen to have a machine with 2.6 on it available right now. I will test later with 2.6.
The only thing I would qualify as a Change was in test_signatures.py:test_collect_parameters(), I made all the inputs unicode. The old code path worked in Python2 because it's a bit looser. But not in Python3, because 's' != b's'.
I had a hard time telling whether, as a matter of API, collect_parameters required its inputs to be unicode or not, but I assumed it did since so many other bits of API seemed to require that. But if I was wrong, I can go back and fix up that whole code path to work under both encoding (and spit out the same as it was given).