[NumPy-Tickets] [NumPy] #1910: Check buffer bounds in ndarray creation

NumPy Trac numpy-tickets@scipy....
Thu Aug 4 07:44:17 CDT 2011


#1910: Check buffer bounds in ndarray creation
------------------------+---------------------------------------------------
 Reporter:  pv          |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  low         |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.0      
 Keywords:              |  
------------------------+---------------------------------------------------

Comment(by skrah):

 Conversely, this array is currently rejected but should be allowed (I
 think):

 {{{
 >>> x = ndarray(buffer=bytearray(1), shape=[0], strides=[1], dtype="B")
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 ValueError: strides is incompatible with shape of requested array and size
 of buffer
 }}}


 But the rejected array can be created via a slice:

 {{{
 >>> x = ndarray(buffer=bytearray(1), shape=[1], strides=[1], dtype="B")
 >>> y = x[0:0]
 >>> y.shape == (0,)
 True
 >>> y.strides == (1,)
 True
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1910#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list