Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Image.open formats parameter to be case-insensitive #5250

Merged
merged 4 commits into from Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/test_image.py
Expand Up @@ -94,7 +94,7 @@ def test_open_formats(self):
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)

Expand Down
1 change: 1 addition & 0 deletions src/PIL/Image.py
Expand Up @@ -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:
Expand Down