Merge pull request #6902 from radarhere/open

This commit is contained in:
Hugo van Kemenade 2023-01-21 19:06:07 +02:00 committed by GitHub
commit 6d09f3382d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3268,8 +3268,14 @@ def open(fp, mode="r", formats=None):
im = _open_core(fp, filename, prefix, formats)
if im is None and formats is ID:
checked_formats = formats.copy()
if init():
im = _open_core(fp, filename, prefix, formats)
im = _open_core(
fp,
filename,
prefix,
tuple(format for format in formats if format not in checked_formats),
)
if im:
im._exclusive_fp = exclusive_fp