Merge pull request #5946 from radarhere/file_pointer

Ensure duplicated file pointer is closed
This commit is contained in:
Hugo van Kemenade 2022-01-10 07:38:17 +02:00 committed by GitHub
commit ac7f42c2c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1234,6 +1234,12 @@ class TiffImageFile(ImageFile.ImageFile):
# UNDONE -- so much for that buffer size thing.
n, err = decoder.decode(self.fp.read())
if fp:
try:
os.close(fp)
except OSError:
pass
self.tile = []
self.readonly = 0