diff options
author | Thomas Heller <theller@ctypes.org> | 2010-06-21 14:00:24 +0000 |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2010-06-21 14:00:24 +0000 |
commit | f699a9aa6086073f0aca5052d47c0d2df8e60a40 (patch) | |
tree | 21704b75a9ca63e73d6c917cd2eaccb81bcaa1ff /Lib/ctypes | |
parent | 82b5d81fc7550bf42b64cb9bd49aa9c348333fbc (diff) | |
download | cpython-f699a9aa6086073f0aca5052d47c0d2df8e60a40.tar.gz |
Fix #8959 by reverting revision 80761.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/test_win32.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_win32.py b/Lib/ctypes/test/test_win32.py index 3c0500d442..5dedd9f1f6 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): |