mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 10:26:19 +03:00
Merge pull request #3418 from radarhere/webp_fp
Only close existing fp in WebP if fp is exclusive
This commit is contained in:
commit
ed10276a6b
|
@ -138,7 +138,6 @@ class TestFileWebp(PillowTestCase):
|
||||||
self.assertRaises(TypeError, _webp.WebPAnimDecoder)
|
self.assertRaises(TypeError, _webp.WebPAnimDecoder)
|
||||||
self.assertRaises(TypeError, _webp.WebPDecode)
|
self.assertRaises(TypeError, _webp.WebPDecode)
|
||||||
|
|
||||||
@unittest.skip("Currently is not working")
|
|
||||||
def test_no_resource_warning(self):
|
def test_no_resource_warning(self):
|
||||||
file_path = "Tests/images/hopper.webp"
|
file_path = "Tests/images/hopper.webp"
|
||||||
image = Image.open(file_path)
|
image = Image.open(file_path)
|
||||||
|
|
|
@ -164,6 +164,8 @@ class WebPImageFile(ImageFile.ImageFile):
|
||||||
self.__loaded = self.__logical_frame
|
self.__loaded = self.__logical_frame
|
||||||
|
|
||||||
# Set tile
|
# Set tile
|
||||||
|
if self.fp and self._exclusive_fp:
|
||||||
|
self.fp.close()
|
||||||
self.fp = BytesIO(data)
|
self.fp = BytesIO(data)
|
||||||
self.tile = [("raw", (0, 0) + self.size, 0, self.rawmode)]
|
self.tile = [("raw", (0, 0) + self.size, 0, self.rawmode)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user