Commit Graph

213 Commits

Author SHA1 Message Date
Brian Crowell
5076c35cc5 py3k: print is a function
Seriously, if you didn't know that, you've been in a freaking cave, man.
2013-01-10 08:46:46 -06:00
Brian Crowell
da1d715b8e py3k: Use isinstance for numbers and sequences
operator.isNumberType() and .isSequenceType() go away in py3k.
2013-01-10 08:46:45 -06:00
Brian Crowell
fc035814bd py3k: map and filter to list comprehensions
What's really going on is that map() and filter() return iterators in py3k.
I've just gone ahead and turned them all into list comprehensions, because
I find them much easier to read.
2013-01-10 08:46:43 -06:00
Brian Crowell
09f1081c95 py3k: Fix up uses of dictionary views, ranges, and has_key()
y.has_key(x) is gone (use x in y), and keys(), values(), items(), and
range() all return views.

Some iterables needed to be packed into lists, either because the code
expected a list (such as "range(256) * 3") or because the original
collection was being modified (automatic global declarations).

The Tiff ImageFileDictionary is a special case and will be dealt with in
another commit.
2013-01-10 08:46:42 -06:00
Brian Crowell
b386ed14dd py3k: Remove callable() function
callable(c) is isinstance(x, collections.Callable) in py3k.
2013-01-10 08:46:41 -06:00
Brian Crowell
af5228896a py3k: Add module initialization and unicode/bytes int/long thunks
This commit:

* Adds Python 3 module initialization functions. I split out the main init
  of each module into a static setup_module function.
* Adds a py3.h which unifies int/long in Python 3 and unicode/bytes in
  Python 2. _imagingft.c unfortunately looks a little kludgy after this
  because it was already using PyUnicode functions, and I had to mix and
  match there manually.

With this commit, the modules all build successfully under Python 3.

What this commit does NOT do is patch all of the uses of PyArg_ParseTuple
and Py_BuildValue, which all need to be checked for proper use of bytes
and unicode codes. It also does not let selftest.py run yet, because there
are probably hundreds of issues to fix in the Python code itself.
2013-01-10 08:46:37 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Brian Crowell
37f22ebfcd py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-10 08:42:49 -06:00
Tom Payne
e414c66070 Add Image.alpha_composite 2012-12-04 16:44:26 +01:00
Corey Richardson
f466def82d Better import of _imaging 2012-06-15 17:39:51 -03:00
Simon Law
5355fea83e Backport fix to split() after open() (regression in 1.1.7).
https://bitbucket.org/effbot/pil-2009-raclette/changeset/fb7ce579f5f9
2012-01-19 15:07:18 -05:00
Stéphane Klein
c144108396 Fix : resize need int values, append int conversion in thumbnail method 2011-07-20 15:49:37 +02:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00