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

Brian Crowell brian at fluggo.com
Tue Oct 30 23:28:27 CET 2012


On Mon, Oct 29, 2012 at 2:11 PM, Mikhail Korobov <kmike84 at gmail.com> wrote:
> 1) Test running doesn't work for me.
>
>     python Tests/run.py
> ...
> ImportError: No module named __future__

It would be an awfully odd version of Python that didn't recognize a
__future__ import. What version of Python is this, and where did it
come from?


> py.test and nosetest can't even collect the tests from Tests folder so
> something strange is happening :)
>
> It would be great to run PIL tests using tox, but the supplied tox.ini
> config runs only selftest.py (which is broken under Python3, but that's an
> another issue, see https://github.com/fluggo/Pillow/pull/1 ).

I wasn't sure how to tackle selftest.py, so I didn't touch it. I saw
your commit to fix it in your own repository:

  https://github.com/kmike/Pillow/commit/eac71dd8493af7a9bb15f48c63941f5d0b6c763f

If that works, I think I'll just borrow your commit.

I'm not familiar with tox. The Tests directory is grafted onto stock
Pillow, so nothing else was configured to use the tests there.


> 2) fromstring and tostring methods are gone in Python3 version. They have
> unfortunate names but I think it is better not to break the interface. For
> example, I'm writing a Python 2/3 library that uses PIL and this change
> breaks it under Python3. What do you think about issuing a deprecation
> warning instead?

That's a good idea. tobytes/frombytes work in both versions, so I
should issue a deprecation warning that says to switch to those names.

--Brian


More information about the Image-SIG mailing list