Simplified code

This commit is contained in:
Andrew Murray 2024-02-10 16:48:02 +11:00
parent a118a82c30
commit 152a24e13a

View File

@ -3240,10 +3240,8 @@ def open(fp, mode="r", formats=None) -> Image:
exclusive_fp = False exclusive_fp = False
filename = "" filename = ""
if isinstance(fp, os.PathLike): if is_path(fp):
filename = os.path.realpath(os.fspath(fp)) filename = os.path.realpath(os.fspath(fp))
elif is_path(fp):
filename = fp
if filename: if filename:
fp = builtins.open(filename, "rb") fp = builtins.open(filename, "rb")