diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-01-03 16:59:18 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-01-03 16:59:18 (GMT) |
commit | c3b39245a7695cf39ba5524f59deeff52b00e5f9 (patch) | |
tree | 9736aa9a6d7c03b55eeb7d362a53f91d6000dda3 /Include | |
parent | 8bcddcabd770dd424b97d7c667ef8e5337436215 (diff) | |
download | cpython-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 'Include')
-rw-r--r-- | Include/object.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Include/object.h b/Include/object.h index 16708f9..0d20ecc 100644 --- a/Include/object.h +++ b/Include/object.h @@ -144,16 +144,18 @@ typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); typedef struct bufferinfo { void *buf; PyObject *obj; /* owned reference */ - Py_ssize_t len; - Py_ssize_t itemsize; /* This is Py_ssize_t so it can be - pointed to by strides in simple case.*/ - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + Py_ssize_t len; + Py_ssize_t itemsize; /* This is Py_ssize_t so it can be + pointed to by strides in simple case.*/ + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + Py_ssize_t smalltable[2]; /* static store for shape and strides of + mono-dimensional buffers. */ + void *internal; } Py_buffer; typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); |