summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTravis E. Oliphant <oliphant@enthought.com>2007-10-13 21:03:27 (GMT)
committerTravis E. Oliphant <oliphant@enthought.com>2007-10-13 21:03:27 (GMT)
commitddacf968682818a34a90ec6702fbb44098914a9d (patch)
treef7f6ccb66009a525c1f8aa176626a8b95a516cef /Modules
parentd417a154e4fcae12fd17b160762eafe8eec6d3f5 (diff)
downloadcpython-ddacf968682818a34a90ec6702fbb44098914a9d.zip
cpython-ddacf968682818a34a90ec6702fbb44098914a9d.tar.gz
cpython-ddacf968682818a34a90ec6702fbb44098914a9d.tar.bz2
Eliminate use of PyBUF_CHARACTER flag which is no longer part of the buffer interface. Fix up array module to export the correct format for wide-builds.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/arraymodule.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 051063b..cc7769f 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -385,7 +385,7 @@ d_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v)
static struct arraydescr descriptors[] = {
{'b', 1, b_getitem, b_setitem, "b"},
{'B', 1, BB_getitem, BB_setitem, "B"},
- {'u', sizeof(Py_UNICODE), u_getitem, u_setitem, "U"},
+ {'u', sizeof(Py_UNICODE), u_getitem, u_setitem, "u"},
{'h', sizeof(short), h_getitem, h_setitem, "h"},
{'H', sizeof(short), HH_getitem, HH_setitem, "H"},
{'i', sizeof(int), i_getitem, i_setitem, "i"},
@@ -1784,11 +1784,6 @@ static const void *emptybuf = "";
static int
array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
{
- if ((flags & PyBUF_CHARACTER)) {
- PyErr_SetString(PyExc_TypeError,
- "Cannot be a character buffer");
- return -1;
- }
if ((flags & PyBUF_LOCK)) {
PyErr_SetString(PyExc_BufferError,
"Cannot lock data");
@@ -1815,6 +1810,11 @@ array_buffer_getbuf(arrayobject *self, Py_buffer *view, int flags)
view->internal = NULL;
if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) {
view->format = self->ob_descr->formats;
+#ifdef Py_UNICODE_WIDE
+ if (self->ob_descr->typecode == 'u') {
+ view->formats = "w";
+ }
+#endif
}
finish: