mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-09-21 03:18:57 +03:00
Changed int conversion in ImagePalette to ord for Python 2
This commit is contained in:
parent
15586c5b59
commit
4f6f5f9182
|
@ -98,7 +98,8 @@ class ImagePalette(object):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# allocate new color slot
|
# allocate new color slot
|
||||||
if isinstance(self.palette, bytes):
|
if isinstance(self.palette, bytes):
|
||||||
self.palette = [int(x) for x in self.palette]
|
self.palette = [(ord(x) if str is bytes else int(x))
|
||||||
|
for x in self.palette]
|
||||||
index = len(self.colors)
|
index = len(self.colors)
|
||||||
if index >= 256:
|
if index >= 256:
|
||||||
raise ValueError("cannot allocate more than 256 colors")
|
raise ValueError("cannot allocate more than 256 colors")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user