mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-06 06:03:14 +03:00
Enable mmap on PyPy (#8840)
This commit is contained in:
parent
25653d2f87
commit
bce83ac800
|
@ -621,6 +621,8 @@ class Image:
|
||||||
more information.
|
more information.
|
||||||
"""
|
"""
|
||||||
if getattr(self, "map", None):
|
if getattr(self, "map", None):
|
||||||
|
if sys.platform == "win32" and hasattr(sys, "pypy_version_info"):
|
||||||
|
self.map.close()
|
||||||
self.map: mmap.mmap | None = None
|
self.map: mmap.mmap | None = None
|
||||||
|
|
||||||
# Instead of simply setting to None, we're setting up a
|
# Instead of simply setting to None, we're setting up a
|
||||||
|
|
|
@ -34,7 +34,6 @@ import itertools
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
import sys
|
|
||||||
from typing import IO, TYPE_CHECKING, Any, NamedTuple, cast
|
from typing import IO, TYPE_CHECKING, Any, NamedTuple, cast
|
||||||
|
|
||||||
from . import ExifTags, Image
|
from . import ExifTags, Image
|
||||||
|
@ -278,8 +277,6 @@ class ImageFile(Image.Image):
|
||||||
|
|
||||||
self.map: mmap.mmap | None = None
|
self.map: mmap.mmap | None = None
|
||||||
use_mmap = self.filename and len(self.tile) == 1
|
use_mmap = self.filename and len(self.tile) == 1
|
||||||
# As of pypy 2.1.0, memory mapping was failing here.
|
|
||||||
use_mmap = use_mmap and not hasattr(sys, "pypy_version_info")
|
|
||||||
|
|
||||||
readonly = 0
|
readonly = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user