summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2010-03-30 20:57:06 (GMT)
committerThomas Heller <theller@ctypes.org>2010-03-30 20:57:06 (GMT)
commitb102ddadcbcaaf8fc50e5060e45b89a4d3a3a492 (patch)
tree6739d584d917d41633f6fb928da18262001b1382 /Lib/ctypes
parent08b56b60841432aa771d260fa62a825092494167 (diff)
downloadcpython-b102ddadcbcaaf8fc50e5060e45b89a4d3a3a492.zip
cpython-b102ddadcbcaaf8fc50e5060e45b89a4d3a3a492.tar.gz
cpython-b102ddadcbcaaf8fc50e5060e45b89a4d3a3a492.tar.bz2
Revert rev. 79509; ctypes doesn't build on linux.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r--Lib/ctypes/test/test_win32.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_win32.py b/Lib/ctypes/test/test_win32.py
index 3c0500d..5dedd9f 100644
--- a/Lib/ctypes/test/test_win32.py
+++ b/Lib/ctypes/test/test_win32.py
@@ -6,6 +6,32 @@ import unittest, sys
import _ctypes_test
+if sys.platform == "win32" and sizeof(c_void_p) == sizeof(c_int):
+ # Only windows 32-bit has different calling conventions.
+
+ class WindowsTestCase(unittest.TestCase):
+ def test_callconv_1(self):
+ # Testing stdcall function
+
+ IsWindow = windll.user32.IsWindow
+ # ValueError: Procedure probably called with not enough arguments (4 bytes missing)
+ self.assertRaises(ValueError, IsWindow)
+
+ # This one should succeeed...
+ self.assertEqual(0, IsWindow(0))
+
+ # ValueError: Procedure probably called with too many arguments (8 bytes in excess)
+ self.assertRaises(ValueError, IsWindow, 0, 0, 0)
+
+ def test_callconv_2(self):
+ # Calling stdcall function as cdecl
+
+ IsWindow = cdll.user32.IsWindow
+
+ # ValueError: Procedure called with not enough arguments (4 bytes missing)
+ # or wrong calling convention
+ self.assertRaises(ValueError, IsWindow, None)
+
if sys.platform == "win32":
class FunctionCallTestCase(unittest.TestCase):