mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Close the file pointer copy (_fp) in the libtiff encoder if it is still open.
This commit is contained in:
parent
01520de6f7
commit
2299490082
|
@ -1850,6 +1850,11 @@ def _save(im, fp, filename):
|
|||
fp.write(data)
|
||||
if errcode:
|
||||
break
|
||||
if _fp:
|
||||
try:
|
||||
os.close(_fp)
|
||||
except OSError:
|
||||
pass
|
||||
if errcode < 0:
|
||||
msg = f"encoder error {errcode} when writing image file"
|
||||
raise OSError(msg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user