mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-14 15:22:13 +03:00
Merge pull request #5250 from Piolie/open_formats_case
Changed Image.open formats parameter to be case-insensitive
This commit is contained in:
commit
bc0c0cb11a
|
@ -94,7 +94,7 @@ class TestImage:
|
|||
with pytest.raises(TypeError):
|
||||
Image.open(PNGFILE, formats=123)
|
||||
|
||||
for formats in [["JPEG"], ("JPEG",)]:
|
||||
for formats in [["JPEG"], ("JPEG",), ["jpeg"], ["Jpeg"], ["jPeG"], ["JpEg"]]:
|
||||
with pytest.raises(UnidentifiedImageError):
|
||||
Image.open(PNGFILE, formats=formats)
|
||||
|
||||
|
|
|
@ -2922,6 +2922,7 @@ def open(fp, mode="r", formats=None):
|
|||
|
||||
def _open_core(fp, filename, prefix, formats):
|
||||
for i in formats:
|
||||
i = i.upper()
|
||||
if i not in OPEN:
|
||||
init()
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user