mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +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)
|
||||
if encoder.pushes_fd:
|
||||
encoder.setfd(fp)
|
||||
l, s = encoder.encode_to_pyfd()
|
||||
length, error_code = encoder.encode_to_pyfd()
|
||||
else:
|
||||
if exc:
|
||||
# compress to Python file-compatible object
|
||||
while True:
|
||||
l, s, d = encoder.encode(bufsize)
|
||||
fp.write(d)
|
||||
if s:
|
||||
length, error_code, chunk = encoder.encode(bufsize)
|
||||
fp.write(chunk)
|
||||
if error_code:
|
||||
break
|
||||
else:
|
||||
# slight speedup: compress to real file object
|
||||
s = encoder.encode_to_file(fh, bufsize)
|
||||
if s < 0:
|
||||
msg = f"encoder error {s} when writing image file"
|
||||
error_code = encoder.encode_to_file(fh, bufsize)
|
||||
if error_code < 0:
|
||||
msg = f"encoder error {error_code} when writing image file"
|
||||
raise OSError(msg) from exc
|
||||
finally:
|
||||
encoder.cleanup()
|
||||
|
|
Loading…
Reference in New Issue
Block a user