We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2b186fc + d08d7ee commit d568c8dCopy full SHA for d568c8d
1 file changed
src/PIL/Image.py
@@ -404,6 +404,9 @@ def getmodebands(mode: str) -> int:
404
405
def _import_plugin_for_extension(ext: str | bytes) -> bool:
406
"""Import only the plugin needed for a specific file extension."""
407
+ if not ext:
408
+ return False
409
+
410
if isinstance(ext, bytes):
411
ext = ext.decode()
412
ext = ext.lower()
@@ -3633,7 +3636,7 @@ def open(
3633
3636
# Try to import just the plugin needed for this file extension
3634
3637
# before falling back to preinit() which imports common plugins
3635
3638
ext = os.path.splitext(filename)[1] if filename else ""
- if not (ext and _import_plugin_for_extension(ext)):
3639
+ if not _import_plugin_for_extension(ext):
3640
preinit()
3641
3642
warning_messages: list[str] = []
0 commit comments