From 2b63fefe4821baeb9f48a13f6395ba33d7a1a9d9 Mon Sep 17 00:00:00 2001 From: applemonkey496 <55333787+applemonkey496@users.noreply.github.com> Date: Tue, 18 Aug 2020 16:32:16 -0700 Subject: [PATCH] Check type of xy in Image.putpixel Raise a TypeError if xy is not a tuple with types (int, int) --- src/PIL/Image.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 8ab67d55e..c046e6258 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -1733,6 +1733,11 @@ class Image: ): # RGB or RGBA value for a P image 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) def remap_palette(self, dest_map, source_palette=None):