This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mfxmfx
Recipients mfxmfx, theller
Date 2011-01-02.06:59:01
SpamBayes Score 0.058059573
Marked as misclassified No
Message-id <1293951546.17.0.00856255345379.issue10803@psf.upfronthosting.co.za>
In-reply-to
Content
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);
History
Date User Action Args
2011-01-02 06:59:06mfxmfxsetrecipients: + mfxmfx, theller
2011-01-02 06:59:06mfxmfxsetmessageid: <1293951546.17.0.00856255345379.issue10803@psf.upfronthosting.co.za>
2011-01-02 06:59:01mfxmfxlinkissue10803 messages
2011-01-02 06:59:01mfxmfxcreate