mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-29 17:33:08 +03:00
Clear core image if memory mapping was used for last load
This commit is contained in:
parent
7e4d8e2f55
commit
041acf1344
|
@ -52,3 +52,17 @@ def test_tiff_crashes(test_file: str) -> None:
|
|||
pytest.skip("test image not found")
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def test_tiff_mmap() -> None:
|
||||
try:
|
||||
with Image.open("Tests/images/crash_mmap.tif") as im:
|
||||
im.seek(1)
|
||||
im.load()
|
||||
|
||||
im.seek(0)
|
||||
im.load()
|
||||
except FileNotFoundError:
|
||||
if on_ci():
|
||||
raise
|
||||
pytest.skip("test image not found")
|
||||
|
|
|
@ -1217,9 +1217,10 @@ class TiffImageFile(ImageFile.ImageFile):
|
|||
return
|
||||
self._seek(frame)
|
||||
if self._im is not None and (
|
||||
self.im.size != self._tile_size or self.im.mode != self.mode
|
||||
self.im.size != self._tile_size
|
||||
or self.im.mode != self.mode
|
||||
or self.readonly
|
||||
):
|
||||
# The core image will no longer be used
|
||||
self._im = None
|
||||
|
||||
def _seek(self, frame: int) -> None:
|
||||
|
|
Loading…
Reference in New Issue
Block a user