c_void_p.from_param accepts bytes. Fix test_prototypes.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index d6a435d..5b11480 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -1268,6 +1268,7 @@
}
return (PyObject *)parg;
}
+ /* XXX struni: remove later */
/* string */
if (PyString_Check(value)) {
PyCArgObject *parg;
@@ -1285,6 +1286,23 @@
}
return (PyObject *)parg;
}
+/* bytes */
+ if (PyBytes_Check(value)) {
+ PyCArgObject *parg;
+ struct fielddesc *fd = getentry("z");
+
+ parg = new_CArgObject();
+ if (parg == NULL)
+ return NULL;
+ parg->pffi_type = &ffi_type_pointer;
+ parg->tag = 'z';
+ parg->obj = fd->setfunc(&parg->value, value, 0);
+ if (parg->obj == NULL) {
+ Py_DECREF(parg);
+ return NULL;
+ }
+ return (PyObject *)parg;
+ }
/* unicode */
if (PyUnicode_Check(value)) {
PyCArgObject *parg;