Migration to Python 3

OK, I’ve just checked in a range of fixes regarding Python 3 support. Most importantly, I’ve fixed the segmentation fault on module load, which was caused by a stupid brainfart on my end. Sorry about that. :neutral_face:

I’ve also altered makepanda to automatically invoke 2to3 for the “direct” tree when copying it over to the “built” directory. However, genPyCode doesn’t work, because the direct tree is broken. There’s too much cruft in there that still uses old APIs (like new.instancemethod and list.sort(cmp=x)) that can’t be ported so easily to Python 3 (and it isn’t done by 2to3). I’ve made a little bit of progress toward changing the source to use the newer APIs, but there’s still a lot of tedious work ahead. :frowning:

I’d greatly appreciate any help on this, particularly with patching the original source to use newer APIs (rather than hacking custom fixers into 2to3) since a majority of them will still work in Python 2.