mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-29 17:33:08 +03:00
Rearranged code to limit line length
This commit is contained in:
parent
1606d9adf3
commit
59a3e3bc60
|
@ -977,6 +977,7 @@ class Image:
|
||||||
if self.mode == "P":
|
if self.mode == "P":
|
||||||
trns_im.putpalette(self.palette)
|
trns_im.putpalette(self.palette)
|
||||||
if isinstance(t, tuple):
|
if isinstance(t, tuple):
|
||||||
|
err = "Couldn't allocate a palette color for transparency"
|
||||||
try:
|
try:
|
||||||
t = trns_im.palette.getcolor(t, self)
|
t = trns_im.palette.getcolor(t, self)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
|
@ -985,9 +986,7 @@ class Image:
|
||||||
# then there is no need for transparency
|
# then there is no need for transparency
|
||||||
t = None
|
t = None
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(err) from e
|
||||||
"Couldn't allocate a palette color for transparency"
|
|
||||||
) from e
|
|
||||||
if t is None:
|
if t is None:
|
||||||
trns = None
|
trns = None
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user