mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 18:23:24 +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)
|
fp.write(data)
|
||||||
if errcode:
|
if errcode:
|
||||||
break
|
break
|
||||||
|
if _fp:
|
||||||
|
try:
|
||||||
|
os.close(_fp)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
if errcode < 0:
|
if errcode < 0:
|
||||||
msg = f"encoder error {errcode} when writing image file"
|
msg = f"encoder error {errcode} when writing image file"
|
||||||
raise OSError(msg)
|
raise OSError(msg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user