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

Skip to content

Commit 8750384

Browse files
author
Thomas Heller
committed
More easy fixes. The ctypes unittests pass now (on Windows).
1 parent d660fab commit 8750384

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Lib/ctypes/test/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_stringresult(self):
166166
f = dll._testfunc_p_p
167167
f.argtypes = None
168168
f.restype = c_char_p
169-
result = f("123")
169+
result = f(b"123")
170170
self.failUnlessEqual(result, "123")
171171

172172
result = f(None)

Lib/ctypes/test/test_python_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ def test_PyOS_snprintf(self):
7474
PyOS_snprintf.argtypes = POINTER(c_char), c_size_t, c_char_p
7575

7676
buf = c_buffer(256)
77-
PyOS_snprintf(buf, sizeof(buf), "Hello from %s", "ctypes")
77+
PyOS_snprintf(buf, sizeof(buf), "Hello from %s", b"ctypes")
7878
self.failUnlessEqual(buf.value, "Hello from ctypes")
7979

80-
PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", "ctypes", 1, 2, 3)
81-
self.failUnlessEqual(buf.value, "Hello from ctypes")
80+
PyOS_snprintf(buf, sizeof(buf), "Hello from %s (%d, %d, %d)", b"ctypes", 1, 2, 3)
81+
self.failUnlessEqual(buf.value, "Hello from ctypes (1, 2, 3)")
8282

8383
# not enough arguments
8484
self.failUnlessRaises(TypeError, PyOS_snprintf, buf)

0 commit comments

Comments
 (0)