Changed int conversion in ImagePalette to ord for Python 2

This commit is contained in:
Andrew Murray 2015-12-30 09:37:24 +11:00 committed by wiredfool
parent 15586c5b59
commit 4f6f5f9182

View File

@ -98,7 +98,8 @@ class ImagePalette(object):
except KeyError:
# allocate new color slot
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)
if index >= 256:
raise ValueError("cannot allocate more than 256 colors")