滿天的星座2017-06-10 09:50:40
PyByteArray_FromStringAndSize 或Py_BuildValue先把char *轉成bytes
然後PyTuple_SetItem把bytes 轉成tuple
PyObject * bytesObject = PyByteArray_FromStringAndSize(message, len);
PyObject * buildObject = Py_BuildValue("y#", message,len);
PyObject * argsObject = PyTuple_New(1);
PyTuple_SetItem(argsObject, 0, bytesObject);