[Python-checkins] cpython: #22732 ctypes tests don't set correct restype for intptr_t functions

steve.dower python-checkins at python.org
Sat Nov 1 23:16:09 CET 2014


https://hg.python.org/cpython/rev/a944fe09fae8
changeset:   93336:a944fe09fae8
user:        Steve Dower <steve.dower at microsoft.com>
date:        Sat Nov 01 15:14:27 2014 -0700
summary:
  #22732 ctypes tests don't set correct restype for intptr_t functions

files:
  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
--- a/Lib/ctypes/test/test_pointers.py
+++ b/Lib/ctypes/test/test_pointers.py
@@ -24,7 +24,10 @@
     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
--- a/Lib/ctypes/test/test_prototypes.py
+++ b/Lib/ctypes/test/test_prototypes.py
@@ -69,7 +69,10 @@
 
     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)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list