mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-08 13:53:21 +03:00
Fixing test failures on python 2.6/windows
This commit is contained in:
parent
0f9f5cd8db
commit
21beef192a
|
@ -10,7 +10,14 @@ class TestImageGetIm(PillowTestCase):
|
||||||
if py3:
|
if py3:
|
||||||
self.assertIn("PyCapsule", type_repr)
|
self.assertIn("PyCapsule", type_repr)
|
||||||
|
|
||||||
self.assertIsInstance(im.im.id, int)
|
|
||||||
|
try:
|
||||||
|
#py2.6
|
||||||
|
target_types = (int, long)
|
||||||
|
except:
|
||||||
|
target_types = (int)
|
||||||
|
|
||||||
|
self.assertIsInstance(im.im.id, target_types)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -72,7 +72,11 @@ if sys.platform.startswith('win32'):
|
||||||
memcpy(bp, ctypes.byref(bf), ctypes.sizeof(bf))
|
memcpy(bp, ctypes.byref(bf), ctypes.sizeof(bf))
|
||||||
memcpy(bp + ctypes.sizeof(bf), ctypes.byref(bi), bi.biSize)
|
memcpy(bp + ctypes.sizeof(bf), ctypes.byref(bi), bi.biSize)
|
||||||
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
memcpy(bp + bf.bfOffBits, pixels, bi.biSizeImage)
|
||||||
|
try:
|
||||||
return bytearray(buf)
|
return bytearray(buf)
|
||||||
|
except:
|
||||||
|
# py2.6
|
||||||
|
return buffer(buf)[:]
|
||||||
|
|
||||||
class TestImageWinPointers(PillowTestCase):
|
class TestImageWinPointers(PillowTestCase):
|
||||||
def test_pointer(self):
|
def test_pointer(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user