mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-29 23:17:49 +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 | # Helpers | ||||||
| 
 | 
 | ||||||
| def _tilesort(t1, t2): | def _tilesort(t): | ||||||
|     # sort on offset |     # sort on offset | ||||||
|     return cmp(t1[2], t2[2]) |     return t[2] | ||||||
| 
 | 
 | ||||||
| # | # | ||||||
| # -------------------------------------------------------------------- | # -------------------------------------------------------------------- | ||||||
|  | @ -178,7 +178,7 @@ class ImageFile(Image.Image): | ||||||
|         if not self.map: |         if not self.map: | ||||||
| 
 | 
 | ||||||
|             # sort tiles in file order |             # sort tiles in file order | ||||||
|             self.tile.sort(_tilesort) |             self.tile.sort(key=_tilesort) | ||||||
| 
 | 
 | ||||||
|             try: |             try: | ||||||
|                 # FIXME: This is a hack to handle TIFF's JpegTables tag. |                 # FIXME: This is a hack to handle TIFF's JpegTables tag. | ||||||
|  | @ -470,7 +470,7 @@ def _save(im, fp, tile): | ||||||
|     im.load() |     im.load() | ||||||
|     if not hasattr(im, "encoderconfig"): |     if not hasattr(im, "encoderconfig"): | ||||||
|         im.encoderconfig = () |         im.encoderconfig = () | ||||||
|     tile.sort(_tilesort) |     tile.sort(key=_tilesort) | ||||||
|     # FIXME: make MAXBLOCK a configuration parameter |     # FIXME: make MAXBLOCK a configuration parameter | ||||||
|     bufsize = max(MAXBLOCK, im.size[0] * 4) # see RawEncode.c |     bufsize = max(MAXBLOCK, im.size[0] * 4) # see RawEncode.c | ||||||
|     try: |     try: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user