Support Python 3 #56

Merged
merged 3 commits into from Oct 23, 2012

Conversation

Projects
None yet
3 participants

mikix commented Aug 31, 2012

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).

Support Python 3
These are mostly unicode string related changes and a few syntax ones.

#55

This pull request fails (merged 95c2463 into dcbc028).

mikix commented Aug 31, 2012

Uh. I seemed to have created a new issue, sorry. I'm not super familiar with github.

This pull request fails (merged d06f017 into dcbc028).

mikix commented Sep 3, 2012

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.

This pull request passes (merged 56a5c73 into dcbc028).

Collaborator

ib-lundgren commented Sep 6, 2012

Great work! Will try and look into this during the weekend if none beats me to it.

mikix commented Sep 10, 2012

FYI, I pushed this patch to Ubuntu. So it should be getting some real world testing.

Collaborator

ib-lundgren commented Oct 23, 2012

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 =)

@ib-lundgren ib-lundgren merged commit 56a5c73 into idan:master Oct 23, 2012

1 check passed

default The Travis build passed
Details
Collaborator

ib-lundgren commented Oct 23, 2012

Thanks once again for this! I've monkey patched in assertIsInstance into TestCase for 3.1 and the 3.3 issues are in #62.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment