mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Merge pull request #1864 from hdante/read-only-load
Make ImageFile load images in read-only mode
This commit is contained in:
commit
b3d78d7c36
|
@ -163,10 +163,9 @@ class ImageFile(Image.Image):
|
|||
else:
|
||||
# use mmap, if possible
|
||||
import mmap
|
||||
fp = open(self.filename, "r+")
|
||||
fp = open(self.filename, "r")
|
||||
size = os.path.getsize(self.filename)
|
||||
# FIXME: on Unix, use PROT_READ etc
|
||||
self.map = mmap.mmap(fp.fileno(), size)
|
||||
self.map = mmap.mmap(fp.fileno(), size, access=mmap.ACCESS_READ)
|
||||
self.im = Image.core.map_buffer(
|
||||
self.map, self.size, d, e, o, a
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user