mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +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
|
from helper import unittest, PillowTestCase, hopper, py3
|
||||||
|
import sys
|
||||||
|
|
||||||
class TestImageGetIm(PillowTestCase):
|
class TestImageGetIm(PillowTestCase):
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ class TestImageGetIm(PillowTestCase):
|
||||||
self.assertIn("PyCapsule", type_repr)
|
self.assertIn("PyCapsule", type_repr)
|
||||||
|
|
||||||
|
|
||||||
try:
|
if sys.hexversion < 0x2070000:
|
||||||
#py2.6
|
# py2.6 x64, windows
|
||||||
target_types = (int, long)
|
target_types = (int, long)
|
||||||
except:
|
else:
|
||||||
target_types = (int)
|
target_types = (int)
|
||||||
|
|
||||||
self.assertIsInstance(im.im.id, target_types)
|
self.assertIsInstance(im.im.id, target_types)
|
||||||
|
|
|
@ -74,7 +74,7 @@ if sys.platform.startswith('win32'):
|
||||||
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
||||||
try:
|
try:
|
||||||
return bytearray(buf)
|
return bytearray(buf)
|
||||||
except:
|
except ValueError:
|
||||||
# py2.6
|
# py2.6
|
||||||
return buffer(buf)[:]
|
return buffer(buf)[:]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user