From 53683965aaf2895fbdb851e07436c6f86b48d0dc Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 1 Nov 2014 15:14:27 -0700 Subject: #22732 ctypes tests don't set correct restype for intptr_t functions --- Lib/ctypes/test/test_pointers.py | 5 ++++- Lib/ctypes/test/test_prototypes.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/ctypes/test/test_pointers.py b/Lib/ctypes/test/test_pointers.py index 4cd3a7a..78e3357 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 818c111..cd0c649 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) -- cgit v0.12