mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Do not retry past formats when loading all formats for the first time
This commit is contained in:
parent
0b53853941
commit
bf0abdca27
|
@ -3268,8 +3268,14 @@ def open(fp, mode="r", formats=None):
|
||||||
im = _open_core(fp, filename, prefix, formats)
|
im = _open_core(fp, filename, prefix, formats)
|
||||||
|
|
||||||
if im is None and formats is ID:
|
if im is None and formats is ID:
|
||||||
|
checked_formats = formats.copy()
|
||||||
if init():
|
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:
|
if im:
|
||||||
im._exclusive_fp = exclusive_fp
|
im._exclusive_fp = exclusive_fp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user