From: Steve Dower Date: Sat, 1 Nov 2014 22:14:27 +0000 (-0700) Subject: #22732 ctypes tests don't set correct restype for intptr_t functions X-Git-Tag: v3.5.0a1~544 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=53683965aaf2895fbdb851e07436c6f86b48d0dc;p=python #22732 ctypes tests don't set correct restype for intptr_t functions --- diff --git a/Lib/ctypes/test/test_pointers.py b/Lib/ctypes/test/test_pointers.py index 4cd3a7a689..78e3357134 100644 --- a/Lib/ctypes/test/test_pointers.py +++ b/Lib/ctypes/test/test_pointers.py @@ -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),) diff --git a/Lib/ctypes/test/test_prototypes.py b/Lib/ctypes/test/test_prototypes.py index 818c1110e3..cd0c649de3 100644 --- a/Lib/ctypes/test/test_prototypes.py +++ b/Lib/ctypes/test/test_prototypes.py @@ -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)