Combined duplicate lines

This commit is contained in:
Andrew Murray 2017-09-06 11:21:50 +10:00
parent e0eb92ac0e
commit e02f828358

View File

@ -1494,14 +1494,13 @@ class Image(object):
mode = getmodebase(self.mode) + "A" mode = getmodebase(self.mode) + "A"
try: try:
self.im.setmode(mode) self.im.setmode(mode)
self.pyaccess = None
except (AttributeError, ValueError): except (AttributeError, ValueError):
# do things the hard way # do things the hard way
im = self.im.convert(mode) im = self.im.convert(mode)
if im.mode not in ("LA", "RGBA"): if im.mode not in ("LA", "RGBA"):
raise ValueError # sanity check raise ValueError # sanity check
self.im = im self.im = im
self.pyaccess = None self.pyaccess = None
self.mode = self.im.mode self.mode = self.im.mode
except (KeyError, ValueError): except (KeyError, ValueError):
raise ValueError("illegal image mode") raise ValueError("illegal image mode")