close the fd, if possible. Fixes #526

This commit is contained in:
wiredfool 2014-03-27 22:18:40 -07:00
parent b73b4a7b63
commit 9552d9bc66

View File

@ -729,6 +729,9 @@ class TiffImageFile(ImageFile.ImageFile):
self.tile = []
self.readonly = 0
# libtiff closed the fp in a, we need to close self.fp, if possible
if hasattr(self.fp, 'close'):
self.fp.close()
self.fp = None # might be shared
if e < 0: