Version check rather than try/except

This commit is contained in:
wiredfool 2016-01-03 13:04:04 -08:00
parent 21beef192a
commit 859ce84976
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
from helper import unittest, PillowTestCase, hopper, py3
import sys
class TestImageGetIm(PillowTestCase):
@ -11,10 +11,10 @@ class TestImageGetIm(PillowTestCase):
self.assertIn("PyCapsule", type_repr)
try:
#py2.6
if sys.hexversion < 0x2070000:
# py2.6 x64, windows
target_types = (int, long)
except:
else:
target_types = (int)
self.assertIsInstance(im.im.id, target_types)

View File

@ -74,7 +74,7 @@ if sys.platform.startswith('win32'):
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
try:
return bytearray(buf)
except:
except ValueError:
# py2.6
return buffer(buf)[:]