]> granicus.if.org Git - python/commitdiff
#22732 ctypes tests don't set correct restype for intptr_t functions
authorSteve Dower <steve.dower@microsoft.com>
Sat, 1 Nov 2014 22:14:27 +0000 (15:14 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Sat, 1 Nov 2014 22:14:27 +0000 (15:14 -0700)
Lib/ctypes/test/test_pointers.py
Lib/ctypes/test/test_prototypes.py

index 4cd3a7a689c8cbd53a18d3e83354e9dc476fc537..78e33571343f098e0c70f158d95a7ce587e6d7fa 100644 (file)
@@ -24,7 +24,10 @@ class PointersTestCase(unittest.TestCase):
     def test_pass_pointers(self):
         dll = CDLL(_ctypes_test.__file__)
         func = dll._testfunc_p_p
-        func.restype = c_long
+        if sizeof(c_longlong) == sizeof(c_void_p):
+            func.restype = c_longlong
+        else:
+            func.restype = c_long
 
         i = c_int(12345678)
 ##        func.argtypes = (POINTER(c_int),)
index 818c1110e3303acf17edb4eb19074f546d21552c..cd0c649de3e31b1829124779bb9b1d362951b21d 100644 (file)
@@ -69,7 +69,10 @@ class CharPointersTestCase(unittest.TestCase):
 
     def test_int_pointer_arg(self):
         func = testdll._testfunc_p_p
-        func.restype = c_long
+        if sizeof(c_longlong) == sizeof(c_void_p):
+            func.restype = c_longlong
+        else:
+            func.restype = c_long
         self.assertEqual(0, func(0))
 
         ci = c_int(0)