2007-09-16

importlib ported to Py3K

I just finished porting importlib over to Py3K. I basically created a Py3K directory in importlib's sandbox and just copied the requisite files over, ran them through 2to3, and then made changes as needed (first in the original files when possible, and then Py3K-only changes).

The only Py3K-specific changes I had to make was for the bytes type. Stuff such as imp.get_magic() and reading bytecode in binary returns bytes and that just doesn't work for comparing against string literals or passing to ord(). =) I also had some integer division that should have been flooring instead of true division. But otherwise it's now converted.

Unfortunately if I make any changes to the original files I am going to have to forward-port it. What I think would be the best solution is have a script that copies the originals, run them through 2to3, and then apply Py3K-specific patches (which would be checked into svn). That way I can develop on the 2.x code and then just make the Py3K code an after-thought. If I have to tweak any code in the 2.x version I will probably bother with this, but not right now. =)