summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2014-11-05 05:21:22 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2014-11-05 05:21:22 (GMT)
commitb7fa2011133b3ae5f246d37cdaa24572953b53ec (patch)
treece7cb0b2975407ec26e01fe8e905d689c9212753 /Lib/ctypes
parentfbaf9310965f5ea491b9ed7b1b6e5db4f73e4def (diff)
downloadcpython-b7fa2011133b3ae5f246d37cdaa24572953b53ec.zip
cpython-b7fa2011133b3ae5f246d37cdaa24572953b53ec.tar.gz
cpython-b7fa2011133b3ae5f246d37cdaa24572953b53ec.tar.bz2
Issue #20160: broken ctypes calling convention on MSVC / 64-bit Windows (large structs) Patch by mattip
Diffstat (limited to 'Lib/ctypes')
-rw-r--r--Lib/ctypes/test/test_win32.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/Lib/ctypes/test/test_win32.py b/Lib/ctypes/test/test_win32.py
index 93573dd..b90ab71 100644
--- a/Lib/ctypes/test/test_win32.py
+++ b/Lib/ctypes/test/test_win32.py
@@ -111,9 +111,29 @@ class Structures(unittest.TestCase):
dll = CDLL(_ctypes_test.__file__)
- pt = POINT(10, 10)
- rect = RECT(0, 0, 20, 20)
- self.assertEqual(1, dll.PointInRect(byref(rect), pt))
+ pt = POINT(15, 25)
+ left = c_long.in_dll(dll, 'left')
+ top = c_long.in_dll(dll, 'top')
+ right = c_long.in_dll(dll, 'right')
+ bottom = c_long.in_dll(dll, 'bottom')
+ rect = RECT(left, top, right, bottom)
+ PointInRect = dll.PointInRect
+ PointInRect.argtypes = [POINTER(RECT), POINT]
+ self.assertEqual(1, PointInRect(byref(rect), pt))
+
+ ReturnRect = dll.ReturnRect
+ ReturnRect.argtypes = [c_int, RECT, POINTER(RECT), POINT, RECT,
+ POINTER(RECT), POINT, RECT]
+ ReturnRect.restype = RECT
+ for i in range(4):
+ ret = ReturnRect(i, rect, pointer(rect), pt, rect,
+ byref(rect), pt, rect)
+ # the c function will check and modify ret if something is
+ # passed in improperly
+ self.assertEqual(ret.left, left.value)
+ self.assertEqual(ret.right, right.value)
+ self.assertEqual(ret.top, top.value)
+ self.assertEqual(ret.bottom, bottom.value)
if __name__ == '__main__':
unittest.main()