Skip to content

Commit 096c479

Browse files
hugovkradarhere
andauthored
If plugin has already been imported and registered the extension, return early
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
1 parent 7f38f98 commit 096c479

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/PIL/Image.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ def _load_plugin_for_extension(ext: str | bytes) -> bool:
406406
"""Load only the plugin needed for a specific file extension."""
407407
if isinstance(ext, bytes):
408408
ext = ext.decode()
409+
if ext in EXTENSION:
410+
return True
411+
409412
plugin = _EXTENSION_PLUGIN.get(ext.lower())
410413
if plugin is None:
411414
return False

0 commit comments

Comments
 (0)