Skip to content

Commit

Permalink
Merge pull request #7594 from radarhere/olefile
Browse files Browse the repository at this point in the history
Fixed closing file pointer with olefile 0.47
  • Loading branch information
hugovk authored Dec 2, 2023
2 parents 76446ee + 0e523d9 commit 2b5c081
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/PIL/FpxImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def _open_subimage(self, index=1, subimage=0):
break # isn't really required

self.stream = stream
self._fp = self.fp
self.fp = None

def load(self):
Expand Down
3 changes: 3 additions & 0 deletions src/PIL/MicImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def _open(self):
self._n_frames = len(self.images)
self.is_animated = self._n_frames > 1

self.__fp = self.fp
self.seek(0)

def seek(self, frame):
Expand All @@ -87,10 +88,12 @@ def tell(self):
return self.frame

def close(self):
self.__fp.close()
self.ole.close()
super().close()

def __exit__(self, *args):
self.__fp.close()
self.ole.close()
super().__exit__()

Expand Down

0 comments on commit 2b5c081

Please sign in to comment.