mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Merge pull request #5633 from radarhere/save_path
Corrected pathlib.Path detection when saving
This commit is contained in:
commit
2e5ce839ba
|
@ -149,10 +149,11 @@ class TestImage:
|
|||
assert im.mode == "RGB"
|
||||
assert im.size == (128, 128)
|
||||
|
||||
temp_file = str(tmp_path / "temp.jpg")
|
||||
if os.path.exists(temp_file):
|
||||
os.remove(temp_file)
|
||||
im.save(Path(temp_file))
|
||||
for ext in (".jpg", ".jp2"):
|
||||
temp_file = str(tmp_path / ("temp." + ext))
|
||||
if os.path.exists(temp_file):
|
||||
os.remove(temp_file)
|
||||
im.save(Path(temp_file))
|
||||
|
||||
def test_fp_name(self, tmp_path):
|
||||
temp_file = str(tmp_path / "temp.jpg")
|
||||
|
|
|
@ -2180,12 +2180,12 @@ class Image:
|
|||
|
||||
filename = ""
|
||||
open_fp = False
|
||||
if isPath(fp):
|
||||
filename = fp
|
||||
open_fp = True
|
||||
elif isinstance(fp, Path):
|
||||
if isinstance(fp, Path):
|
||||
filename = str(fp)
|
||||
open_fp = True
|
||||
elif isPath(fp):
|
||||
filename = fp
|
||||
open_fp = True
|
||||
elif fp == sys.stdout:
|
||||
try:
|
||||
fp = sys.stdout.buffer
|
||||
|
|
Loading…
Reference in New Issue
Block a user