[New-bugs-announce] [issue4580] slicing of memoryviews when itemsize != 1 is wrong
Antoine Pitrou
report at bugs.python.org
Sun Dec 7 21:31:47 CET 2008
New submission from Antoine Pitrou <pitrou at free.fr>:
The problem is with the `shape` member which doesn't get recalculated as
it should when instantiating a memoryview slice:
>>> a = array('i', range(10))
>>> m = memoryview(a)[2:8]
>>> a
array('i', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> m[:] = array('i', range(6))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: cannot modify size of memoryview object
>>> len(m)
6
>>> m.shape
(10,)
An additional problem is that `shape` is a pointer to an array of
integers, and we don't know how to reallocate it.
----------
components: Interpreter Core
messages: 77248
nosy: pitrou
priority: high
severity: normal
stage: test needed
status: open
title: slicing of memoryviews when itemsize != 1 is wrong
type: behavior
versions: Python 3.0, Python 3.1
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4580>
_______________________________________
More information about the New-bugs-announce
mailing list