diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py index 3fad8237c..ab244f898 100644 --- a/Tests/test_file_webp.py +++ b/Tests/test_file_webp.py @@ -138,7 +138,6 @@ class TestFileWebp(PillowTestCase): self.assertRaises(TypeError, _webp.WebPAnimDecoder) self.assertRaises(TypeError, _webp.WebPDecode) - @unittest.skip("Currently is not working") def test_no_resource_warning(self): file_path = "Tests/images/hopper.webp" image = Image.open(file_path) diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index 52f997954..12dd19eca 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -164,6 +164,8 @@ class WebPImageFile(ImageFile.ImageFile): self.__loaded = self.__logical_frame # Set tile + if self.fp and self._exclusive_fp: + self.fp.close() self.fp = BytesIO(data) self.tile = [("raw", (0, 0) + self.size, 0, self.rawmode)]