Check type of xy in Image.putpixel

Raise a TypeError if xy is not a tuple with types (int, int)
This commit is contained in:
applemonkey496 2020-08-18 16:32:16 -07:00 committed by GitHub
parent 8deaebd5e0
commit 2b63fefe48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1733,6 +1733,11 @@ class Image:
): ):
# RGB or RGBA value for a P image # RGB or RGBA value for a P image
value = self.palette.getcolor(value) value = self.palette.getcolor(value)
if self.mode = "L":
if (type(xy[0]) is not int) or (type(xy[1]) is not int):
raise TypeError(f"Expected argument xy to be a tuple (int, int) but got { xy }")
return self.im.putpixel(xy, value) return self.im.putpixel(xy, value)
def remap_palette(self, dest_map, source_palette=None): def remap_palette(self, dest_map, source_palette=None):