summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-01-03 16:59:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-01-03 16:59:18 (GMT)
commitc3b39245a7695cf39ba5524f59deeff52b00e5f9 (patch)
tree9736aa9a6d7c03b55eeb7d362a53f91d6000dda3 /Objects/unicodeobject.c
parent8bcddcabd770dd424b97d7c667ef8e5337436215 (diff)
downloadcpython-c3b39245a7695cf39ba5524f59deeff52b00e5f9.zip
cpython-c3b39245a7695cf39ba5524f59deeff52b00e5f9.tar.gz
cpython-c3b39245a7695cf39ba5524f59deeff52b00e5f9.tar.bz2
Issue #4580: slicing of memoryviews when itemsize != 1 is wrong.
Also fix len() to return number of items rather than length in bytes. I'm sorry it was not possible for me to work on this without reindenting a bit some stuff around. The indentation in memoryobject.c is a mess, I'll open a separate bug for it.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 3a33429..8316e91 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1205,7 +1205,7 @@ PyObject *PyUnicode_Decode(const char *s,
/* Decode via the codec registry */
buffer = NULL;
- if (PyBuffer_FillInfo(&info, NULL, (void *)s, size, 1, PyBUF_SIMPLE) < 0)
+ if (PyBuffer_FillInfo(&info, NULL, (void *)s, size, 1, PyBUF_FULL_RO) < 0)
goto onError;
buffer = PyMemoryView_FromBuffer(&info);
if (buffer == NULL)