[Image-SIG] Python 3 port -- first pass finished

Alex Clark aclark at aclark.net
Sun Oct 21 22:54:35 CEST 2012

On 2012-10-21 16:41:46 +0000, Brian Crowell said:

> I completed my first pass at a Python 2.6/3.2 port. You can find it at:
>   https://github.com/fluggo/Pillow
> Please check it out and test it.
> This port is largely based on previous ports by Christoph Gohlke and
> Hajime Nakagami. You can find both ports in my git tree as single
> commits for comparison.
> With a project this big and complicated, there will be hidden bugs.
> I've tested this with Christoph Gohlke's test suite (included) which
> runs 79 of 82 tests successfully on Python 2.6.8, 2.7.3rc3, and 3.2.3
> (the versions of Python found in debian-testing).
> You should expect zero regressions using this library in Python 2.6 or
> 2.7, with one exception: Image text, such as comments and tags, is now
> decoded with a specific character encoding, so the same text might
> appear differently. In Python 3, image comments and tags are now
> decoded to Unicode strings.
> Check this code out, build it, and test it. The documentation tests
> haven't been updated to work in Python 3, but you can use Gohlke's
> tests by running:
>   python Tests/run.py
>   python3 -bb Tests/run.py
> The -bb switch stops the test if there are invalid bytes/str
> comparisons. Individual tests can be run from the Pillow root like
> this:
>   PYTHONPATH=. python Tests/test_imagefont.py
>   PYTHONPATH=. python3 -bb Tests/test_imagefont.py
> *Skipped tests:* Three of Gohlke's tests don't run on my laptop. I
> haven't bothered to find out why. Investigate the test_imagegl,
> test_imagegrab, and test_imageqt tests.
> *Windows build:* I haven't attempted a Windows build or any tests
> there. For all I know, the GDI code might not even compile.
> Your Python 2.6/2.7 code should run with no changes. (If you have to
> change your code, I've got a bug, so please tell me.)
> You should, however, start to change all tostring/fromstring calls to
> tobytes/frombytes. tobytes() and frombytes() are declared in both
> Python 2 and Python 3, but tostring() and fromstring() are only
> aliased on Python 2.
> In Python 3, all image data is represented in bytes objects, not str.
> str is now Unicode, so binary data doesn't belong there.
> For more information on the changes, please read my comments in the
> patch series.
> Feedback is welcome and much appreciated.

You rock! I'm planning to do another PIllow release this month and will 
try to find some time to test this.

> --Brian
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig

Alex Clark · https://www.gittip.com/aclark4life/

More information about the Image-SIG mailing list