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

Always initialize all plugins in registered_extensions() #6811

Merged
merged 2 commits into from Dec 23, 2022
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
6 changes: 0 additions & 6 deletions Tests/test_image.py
Expand Up @@ -401,19 +401,13 @@ def test_alpha_inplace(self):
def test_registered_extensions_uninitialized(self):
# Arrange
Image._initialized = 0
extension = Image.EXTENSION
Image.EXTENSION = {}

# Act
Image.registered_extensions()

# 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
Expand Down
3 changes: 1 addition & 2 deletions src/PIL/Image.py
Expand Up @@ -3417,8 +3417,7 @@ def registered_extensions():
Returns a dictionary containing all file extensions belonging
to registered plugins
"""
if not EXTENSION:
init()
init()
return EXTENSION


Expand Down