mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
commit
9abedaab1d
|
@ -121,7 +121,7 @@ USE_CFFI_ACCESS = hasattr(sys, 'pypy_version_info')
|
||||||
try:
|
try:
|
||||||
import cffi
|
import cffi
|
||||||
HAS_CFFI = True
|
HAS_CFFI = True
|
||||||
except:
|
except ImportError:
|
||||||
HAS_CFFI = False
|
HAS_CFFI = False
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,7 @@ def Draw(im, mode=None):
|
||||||
# experimental access to the outline API
|
# experimental access to the outline API
|
||||||
try:
|
try:
|
||||||
Outline = Image.core.outline
|
Outline = Image.core.outline
|
||||||
except:
|
except AttributeError:
|
||||||
Outline = None
|
Outline = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,10 +173,10 @@ class ImageFile(Image.Image):
|
||||||
else:
|
else:
|
||||||
# use mmap, if possible
|
# use mmap, if possible
|
||||||
import mmap
|
import mmap
|
||||||
file = open(self.filename, "r+")
|
fp = open(self.filename, "r+")
|
||||||
size = os.path.getsize(self.filename)
|
size = os.path.getsize(self.filename)
|
||||||
# FIXME: on Unix, use PROT_READ etc
|
# FIXME: on Unix, use PROT_READ etc
|
||||||
self.map = mmap.mmap(file.fileno(), size)
|
self.map = mmap.mmap(fp.fileno(), size)
|
||||||
self.im = Image.core.map_buffer(
|
self.im = Image.core.map_buffer(
|
||||||
self.map, self.size, d, e, o, a
|
self.map, self.size, d, e, o, a
|
||||||
)
|
)
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ImageFont(object):
|
||||||
|
|
||||||
def _load_pilfont(self, filename):
|
def _load_pilfont(self, filename):
|
||||||
|
|
||||||
file = open(filename, "rb")
|
fp = open(filename, "rb")
|
||||||
|
|
||||||
for ext in (".png", ".gif", ".pbm"):
|
for ext in (".png", ".gif", ".pbm"):
|
||||||
try:
|
try:
|
||||||
|
@ -83,7 +83,7 @@ class ImageFont(object):
|
||||||
|
|
||||||
self.file = fullname
|
self.file = fullname
|
||||||
|
|
||||||
return self._load_pilfont_data(file, image)
|
return self._load_pilfont_data(fp, image)
|
||||||
|
|
||||||
def _load_pilfont_data(self, file, image):
|
def _load_pilfont_data(self, file, image):
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,9 @@ post-patch:
|
||||||
test_output = BytesIO()
|
test_output = BytesIO()
|
||||||
im.save(test_output, "JPEG", qtables=qtables)
|
im.save(test_output, "JPEG", qtables=qtables)
|
||||||
|
|
||||||
"""
|
|
||||||
|
def test_exif_leak(self):
|
||||||
|
"""
|
||||||
pre patch:
|
pre patch:
|
||||||
|
|
||||||
MB
|
MB
|
||||||
|
@ -160,8 +162,6 @@ post patch:
|
||||||
0 11.33
|
0 11.33
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_exif_leak(self):
|
|
||||||
im = hopper('RGB')
|
im = hopper('RGB')
|
||||||
exif = b'12345678'*4096
|
exif = b'12345678'*4096
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, hopper
|
||||||
try:
|
try:
|
||||||
import cffi
|
import cffi
|
||||||
from PIL import PyAccess
|
from PIL import PyAccess
|
||||||
except:
|
except ImportError:
|
||||||
# Skip in setUp()
|
# Skip in setUp()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class TestCffiPutPixel(TestImagePutPixel):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
import cffi
|
import cffi
|
||||||
except:
|
except ImportError:
|
||||||
self.skipTest("No cffi")
|
self.skipTest("No cffi")
|
||||||
|
|
||||||
def test_put(self):
|
def test_put(self):
|
||||||
|
@ -32,7 +32,7 @@ class TestCffiGetPixel(TestImageGetPixel):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
import cffi
|
import cffi
|
||||||
except:
|
except ImportError:
|
||||||
self.skipTest("No cffi")
|
self.skipTest("No cffi")
|
||||||
|
|
||||||
def test_get(self):
|
def test_get(self):
|
||||||
|
@ -45,7 +45,7 @@ class TestCffi(PillowTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
import cffi
|
import cffi
|
||||||
except:
|
except ImportError:
|
||||||
self.skipTest("No cffi")
|
self.skipTest("No cffi")
|
||||||
|
|
||||||
def _test_get_access(self, im):
|
def _test_get_access(self, im):
|
||||||
|
|
|
@ -159,7 +159,7 @@ class TestFileEps(PillowTestCase):
|
||||||
# check all the freaking line endings possible
|
# check all the freaking line endings possible
|
||||||
try:
|
try:
|
||||||
import StringIO
|
import StringIO
|
||||||
except:
|
except ImportError:
|
||||||
# don't skip, it skips everything in the parent test
|
# don't skip, it skips everything in the parent test
|
||||||
return
|
return
|
||||||
t = StringIO.StringIO(test_string)
|
t = StringIO.StringIO(test_string)
|
||||||
|
|
|
@ -4,7 +4,7 @@ from PIL import Image
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PIL import _webp
|
from PIL import _webp
|
||||||
except:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
# Skip in setUp()
|
# Skip in setUp()
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ class TestFileWebpMetadata(PillowTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
from PIL import _webp
|
from PIL import _webp
|
||||||
except:
|
except ImportError:
|
||||||
self.skipTest('WebP support not installed')
|
self.skipTest('WebP support not installed')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ class TestImageQt(PillowTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
try:
|
try:
|
||||||
from PyQt5.QtGui import QImage, qRgb, qRgba
|
from PyQt5.QtGui import QImage, qRgb, qRgba
|
||||||
except:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from PyQt4.QtGui import QImage, qRgb, qRgba
|
from PyQt4.QtGui import QImage, qRgb, qRgba
|
||||||
except:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
from PySide.QtGui import QImage, qRgb, qRgba
|
from PySide.QtGui import QImage, qRgb, qRgba
|
||||||
except:
|
except ImportError:
|
||||||
self.skipTest('PyQt4 or 5 or PySide not installed')
|
self.skipTest('PyQt4 or 5 or PySide not installed')
|
||||||
|
|
||||||
def test_rgb(self):
|
def test_rgb(self):
|
||||||
|
|
|
@ -6,7 +6,7 @@ try:
|
||||||
|
|
||||||
from scipy import misc
|
from scipy import misc
|
||||||
HAS_SCIPY = True
|
HAS_SCIPY = True
|
||||||
except:
|
except ImportError:
|
||||||
HAS_SCIPY = False
|
HAS_SCIPY = False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user