From 2a86d7353f1a1435d564d0ac882268c80fc9486d Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 19 Dec 2022 08:19:15 +1100 Subject: [PATCH] Always initialize all plugins in registered_extensions() --- Tests/test_image.py | 6 ------ src/PIL/Image.py | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Tests/test_image.py b/Tests/test_image.py index b4e81e46613..69a66b85a71 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -401,8 +401,6 @@ def test_alpha_inplace(self): def test_registered_extensions_uninitialized(self): # Arrange Image._initialized = 0 - extension = Image.EXTENSION - Image.EXTENSION = {} # Act Image.registered_extensions() @@ -410,10 +408,6 @@ def test_registered_extensions_uninitialized(self): # Assert assert Image._initialized == 2 - # Restore the original state and assert - Image.EXTENSION = extension - assert Image.EXTENSION - def test_registered_extensions(self): # Arrange # Open an image to trigger plugin registration diff --git a/src/PIL/Image.py b/src/PIL/Image.py index c2216e27ad0..6288f46ef30 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -3418,8 +3418,7 @@ def registered_extensions(): Returns a dictionary containing all file extensions belonging to registered plugins """ - if not EXTENSION: - init() + init() return EXTENSION