New submission from Markus F.X.J. Oberhumer <mar...@oberhumer.com>: Python 3.2b2 does not properly support accessing bytearrays from ctypes, which makes dealing with large buffers somewhat unpleasant.
A very first fix - a simple patch for the z_set() function - is given here. build/Python-3.2b2 $ quilt diff Index: b/Modules/_ctypes/cfield.c =================================================================== --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1363,6 +1363,10 @@ *(char **)ptr = PyBytes_AsString(value); Py_INCREF(value); return value; + } else if (PyByteArray_Check(value)) { + *(char **)ptr = PyByteArray_AsString(value); + Py_INCREF(value); + return value; } else if (PyLong_Check(value)) { #if SIZEOF_VOID_P == SIZEOF_LONG_LONG *(char **)ptr = (char *)PyLong_AsUnsignedLongLongMask(value); ---------- assignee: theller components: ctypes messages: 125032 nosy: mfxmfx, theller priority: normal severity: normal status: open title: ctypes: better support of bytearray objects type: feature request versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10803> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com