allow lists as arguments for Image.new

This commit is contained in:
homm 2016-10-04 03:06:35 +03:00
parent 68a0b5e5a5
commit c5e111e6b8
2 changed files with 8 additions and 6 deletions

View File

@ -1993,7 +1993,7 @@ def _check_size(size):
:returns: True, or raises a ValueError
"""
if not isinstance(size, tuple):
if not isinstance(size, (list, tuple)):
raise ValueError("Size must be a tuple")
if len(size) != 2:
raise ValueError("Size must be a tuple of length 2")

View File

@ -247,6 +247,8 @@ class TestImage(PillowTestCase):
Image.new('RGB', (0,0)) # w,h <= 0
self.assertTrue(Image.new('RGB', (1,1)))
# Should pass lists too
self.assertTrue(Image.new('RGB', [1,1]))
def test_storage_neg(self):
# Storage.c accepted negative values for xsize, ysize. Was