Merge pull request #1248 from radarhere/health

Further health fixes
This commit is contained in:
wiredfool 2015-06-16 11:54:03 -07:00
commit 9abedaab1d
11 changed files with 20 additions and 20 deletions

View File

@ -121,7 +121,7 @@ USE_CFFI_ACCESS = hasattr(sys, 'pypy_version_info')
try:
import cffi
HAS_CFFI = True
except:
except ImportError:
HAS_CFFI = False

View File

@ -301,7 +301,7 @@ def Draw(im, mode=None):
# experimental access to the outline API
try:
Outline = Image.core.outline
except:
except AttributeError:
Outline = None

View File

@ -173,10 +173,10 @@ class ImageFile(Image.Image):
else:
# use mmap, if possible
import mmap
file = 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(file.fileno(), size)
self.map = mmap.mmap(fp.fileno(), size)
self.im = Image.core.map_buffer(
self.map, self.size, d, e, o, a
)

View File

@ -67,7 +67,7 @@ class ImageFont(object):
def _load_pilfont(self, filename):
file = open(filename, "rb")
fp = open(filename, "rb")
for ext in (".png", ".gif", ".pbm"):
try:
@ -83,7 +83,7 @@ class ImageFont(object):
self.file = fullname
return self._load_pilfont_data(file, image)
return self._load_pilfont_data(fp, image)
def _load_pilfont_data(self, file, image):

View File

@ -105,7 +105,9 @@ post-patch:
test_output = BytesIO()
im.save(test_output, "JPEG", qtables=qtables)
"""
def test_exif_leak(self):
"""
pre patch:
MB
@ -160,8 +162,6 @@ post patch:
0 11.33
"""
def test_exif_leak(self):
im = hopper('RGB')
exif = b'12345678'*4096

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, hopper
try:
import cffi
from PIL import PyAccess
except:
except ImportError:
# Skip in setUp()
pass
@ -20,7 +20,7 @@ class TestCffiPutPixel(TestImagePutPixel):
def setUp(self):
try:
import cffi
except:
except ImportError:
self.skipTest("No cffi")
def test_put(self):
@ -32,7 +32,7 @@ class TestCffiGetPixel(TestImageGetPixel):
def setUp(self):
try:
import cffi
except:
except ImportError:
self.skipTest("No cffi")
def test_get(self):
@ -45,7 +45,7 @@ class TestCffi(PillowTestCase):
def setUp(self):
try:
import cffi
except:
except ImportError:
self.skipTest("No cffi")
def _test_get_access(self, im):

View File

@ -159,7 +159,7 @@ class TestFileEps(PillowTestCase):
# check all the freaking line endings possible
try:
import StringIO
except:
except ImportError:
# don't skip, it skips everything in the parent test
return
t = StringIO.StringIO(test_string)

View File

@ -4,7 +4,7 @@ from PIL import Image
try:
from PIL import _webp
except:
except ImportError:
pass
# Skip in setUp()

View File

@ -8,7 +8,7 @@ class TestFileWebpMetadata(PillowTestCase):
def setUp(self):
try:
from PIL import _webp
except:
except ImportError:
self.skipTest('WebP support not installed')
return

View File

@ -19,13 +19,13 @@ class TestImageQt(PillowTestCase):
def setUp(self):
try:
from PyQt5.QtGui import QImage, qRgb, qRgba
except:
except ImportError:
try:
from PyQt4.QtGui import QImage, qRgb, qRgba
except:
except ImportError:
try:
from PySide.QtGui import QImage, qRgb, qRgba
except:
except ImportError:
self.skipTest('PyQt4 or 5 or PySide not installed')
def test_rgb(self):

View File

@ -6,7 +6,7 @@ try:
from scipy import misc
HAS_SCIPY = True
except:
except ImportError:
HAS_SCIPY = False