mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Changed mmap file pointer to use context manager
This commit is contained in:
parent
dbf899fb78
commit
c971bac651
|
@ -174,7 +174,7 @@ class ImageFile(Image.Image):
|
|||
else:
|
||||
# use mmap, if possible
|
||||
import mmap
|
||||
fp = open(self.filename, "r")
|
||||
with open(self.filename, "r") as fp:
|
||||
self.map = mmap.mmap(fp.fileno(), 0, access=mmap.ACCESS_READ)
|
||||
self.im = Image.core.map_buffer(
|
||||
self.map, self.size, decoder_name, extents, offset, args
|
||||
|
|
Loading…
Reference in New Issue
Block a user