mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Clarify variable names in ImageFile
Co-authored-by: Yay295 <Yay295@users.noreply.github.com>
This commit is contained in:
parent
b6b72170a8
commit
04be46d484
|
@ -530,20 +530,20 @@ def _encode_tile(im, fp, tile, bufsize, fh, exc=None):
|
||||||
encoder.setimage(im.im, b)
|
encoder.setimage(im.im, b)
|
||||||
if encoder.pushes_fd:
|
if encoder.pushes_fd:
|
||||||
encoder.setfd(fp)
|
encoder.setfd(fp)
|
||||||
l, s = encoder.encode_to_pyfd()
|
length, error_code = encoder.encode_to_pyfd()
|
||||||
else:
|
else:
|
||||||
if exc:
|
if exc:
|
||||||
# compress to Python file-compatible object
|
# compress to Python file-compatible object
|
||||||
while True:
|
while True:
|
||||||
l, s, d = encoder.encode(bufsize)
|
length, error_code, chunk = encoder.encode(bufsize)
|
||||||
fp.write(d)
|
fp.write(chunk)
|
||||||
if s:
|
if error_code:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# slight speedup: compress to real file object
|
# slight speedup: compress to real file object
|
||||||
s = encoder.encode_to_file(fh, bufsize)
|
error_code = encoder.encode_to_file(fh, bufsize)
|
||||||
if s < 0:
|
if error_code < 0:
|
||||||
msg = f"encoder error {s} when writing image file"
|
msg = f"encoder error {error_code} when writing image file"
|
||||||
raise OSError(msg) from exc
|
raise OSError(msg) from exc
|
||||||
finally:
|
finally:
|
||||||
encoder.cleanup()
|
encoder.cleanup()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user