size = ctypes.c_int()
ctypes.pythonapi.PyObject_AsCharBuffer(ctypes.py_object(bufferObject),
    ctypes.pointer(data), ctypes.pointer(size))
ctypes.memset(data, 0, size.value)
testObject = 'sneakyctypes'
memsetObject(testObject)
print(repr(testObject))
Как сделать memset с объектом буфера Python?