From 9f04c2d0a513651e6d217fd99b6311f321b60024 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Wed, 20 Aug 2014 21:44:28 -0700 Subject: [PATCH] Don't close fd for multipage files --- PIL/TiffImagePlugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 9bef30ebe..d7367c113 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -744,7 +744,8 @@ class TiffImageFile(ImageFile.ImageFile): 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() + if not self.__next: + self.fp.close() self.fp = None # might be shared if err < 0: