Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5368396

Browse files
committed
#22732 ctypes tests don't set correct restype for intptr_t functions
1 parent 86e9deb commit 5368396

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Lib/ctypes/test/test_pointers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ class A(POINTER(c_ulong)):
2424
def test_pass_pointers(self):
2525
dll = CDLL(_ctypes_test.__file__)
2626
func = dll._testfunc_p_p
27-
func.restype = c_long
27+
if sizeof(c_longlong) == sizeof(c_void_p):
28+
func.restype = c_longlong
29+
else:
30+
func.restype = c_long
2831

2932
i = c_int(12345678)
3033
## func.argtypes = (POINTER(c_int),)

Lib/ctypes/test/test_prototypes.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ def test_paramflags(self):
6969

7070
def test_int_pointer_arg(self):
7171
func = testdll._testfunc_p_p
72-
func.restype = c_long
72+
if sizeof(c_longlong) == sizeof(c_void_p):
73+
func.restype = c_longlong
74+
else:
75+
func.restype = c_long
7376
self.assertEqual(0, func(0))
7477

7578
ci = c_int(0)

0 commit comments

Comments
 (0)