mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Raise FileNotFoundError when opening an empty path (#9048)
This commit is contained in:
commit
84855d11c8
|
@ -160,6 +160,10 @@ class TestImage:
|
|||
with pytest.raises(AttributeError):
|
||||
im.mode = "P" # type: ignore[misc]
|
||||
|
||||
def test_empty_path(self) -> None:
|
||||
with pytest.raises(FileNotFoundError):
|
||||
Image.open("")
|
||||
|
||||
def test_invalid_image(self) -> None:
|
||||
im = io.BytesIO(b"")
|
||||
with pytest.raises(UnidentifiedImageError):
|
||||
|
|
|
@ -3510,8 +3510,6 @@ def open(
|
|||
filename: str | bytes = ""
|
||||
if is_path(fp):
|
||||
filename = os.fspath(fp)
|
||||
|
||||
if filename:
|
||||
fp = builtins.open(filename, "rb")
|
||||
exclusive_fp = True
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user