mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Version check rather than try/except
This commit is contained in:
parent
21beef192a
commit
859ce84976
|
@ -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)
|
||||
|
|
|
@ -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)[:]
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user