summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2009-09-04 18:24:41 (GMT)
committerThomas Heller <theller@ctypes.org>2009-09-04 18:24:41 (GMT)
commit8b939526215754a0317353f9e8d9ed85636101a0 (patch)
tree96a7a388b74c1157f41aa200f8439855b5f95eb6 /Modules
parentb6b13248e5e1090ba71098f76454eaa4cb422eed (diff)
downloadcpython-8b939526215754a0317353f9e8d9ed85636101a0.zip
cpython-8b939526215754a0317353f9e8d9ed85636101a0.tar.gz
cpython-8b939526215754a0317353f9e8d9ed85636101a0.tar.bz2
Issue 6239: ctypes.c_char_p return value must return bytes.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/cfield.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c
index d7966a5..f7fd7fa 100644
--- a/Modules/_ctypes/cfield.c
+++ b/Modules/_ctypes/cfield.c
@@ -1428,7 +1428,8 @@ z_get(void *ptr, Py_ssize_t size)
return NULL;
}
#endif
- return PyUnicode_FromString(*(char **)ptr);
+ return PyBytes_FromStringAndSize(*(char **)ptr,
+ strlen(*(char **)ptr));
} else {
Py_INCREF(Py_None);
return Py_None;