diff Objects/unicodeobject.c @ 50490:26045ed0c26e 3.0

Merged revisions 68200 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r68200 | antoine.pitrou | 2009-01-03 17:59:18 +0100 (sam., 03 janv. 2009) | 8 lines 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. ........
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 03 Jan 2009 17:10:05 +0000
parents ad246cb4f662
children fd4da855d603
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Sat Jan 03 17:06:28 2009 +0000
+++ b/Objects/unicodeobject.c	Sat Jan 03 17:10:05 2009 +0000
@@ -1203,7 +1203,7 @@
 
     /* 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)