-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Closed
Description
Original ticket http://projects.scipy.org/numpy/ticket/1910 on 2011-07-18 by @pv, assigned to unknown.
Forwarded from Stefan Krah:
With a recent NumPy clone + Python3.3, I get this invalid access:
Python 3.3.0a0 (default:1dd6908df8f5, Jul 16 2011, 11:16:00)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> x = ndarray(buffer=bytearray([1,2,3,4,5,6,7,8,9,10]), shape=[2,3], strides=[-3, -2], dtype="B", offset=5)
>>> x
array([[ 6, 4, 2],
[ 3, 1, 251]], dtype='uint8')
>>> x[1][2]
251
>>>
I think NumPy should probably refuse to create such an array, like here:
>>> x = ndarray(buffer=bytearray([1,2,3,4,5,6,7,8,9,10]), shape=[2,3], strides=[-3, -2], dtype="B", offset=0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: strides is incompatible with shape of requested array and size of buffer