mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Added check for flush method existense for file-like object in tiffplugin setup
This commit is contained in:
parent
bbc6f7d6bb
commit
a2b6b661d9
|
@ -935,7 +935,9 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
# flush the file descriptor, prevents error on pypy 2.4+
|
||||
# should also eliminate the need for fp.tell for py3
|
||||
# in _seek
|
||||
self.fp.flush()
|
||||
# flush method may not exist for file-like object.
|
||||
if hasattr(self.fp, 'flush'):
|
||||
self.fp.flush()
|
||||
except IOError:
|
||||
# io.BytesIO have a fileno, but returns an IOError if
|
||||
# it doesn't use a file descriptor.
|
||||
|
|
Loading…
Reference in New Issue
Block a user