mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
py3k: Sort by key, not cmp
Py3k only supports key because it's more efficient. Not even sure 2to3 checks for this.
This commit is contained in:
parent
af94e2d93d
commit
80c2fa60ae
|
@ -56,9 +56,9 @@ def raise_ioerror(error):
|
|||
# --------------------------------------------------------------------
|
||||
# Helpers
|
||||
|
||||
def _tilesort(t1, t2):
|
||||
def _tilesort(t):
|
||||
# sort on offset
|
||||
return cmp(t1[2], t2[2])
|
||||
return t[2]
|
||||
|
||||
#
|
||||
# --------------------------------------------------------------------
|
||||
|
@ -178,7 +178,7 @@ class ImageFile(Image.Image):
|
|||
if not self.map:
|
||||
|
||||
# sort tiles in file order
|
||||
self.tile.sort(_tilesort)
|
||||
self.tile.sort(key=_tilesort)
|
||||
|
||||
try:
|
||||
# FIXME: This is a hack to handle TIFF's JpegTables tag.
|
||||
|
@ -470,7 +470,7 @@ def _save(im, fp, tile):
|
|||
im.load()
|
||||
if not hasattr(im, "encoderconfig"):
|
||||
im.encoderconfig = ()
|
||||
tile.sort(_tilesort)
|
||||
tile.sort(key=_tilesort)
|
||||
# FIXME: make MAXBLOCK a configuration parameter
|
||||
bufsize = max(MAXBLOCK, im.size[0] * 4) # see RawEncode.c
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user