[Numpy-tickets] [NumPy] #982: Problem accessing data attribute of ndarray object created with certain sizes
NumPy
numpy-tickets@scipy....
Fri Jan 9 09:23:33 CST 2009
#982: Problem accessing data attribute of ndarray object created with certain
sizes
------------------------+---------------------------------------------------
Reporter: jtaylor2 | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: 1.3.0
Component: numpy.core | Version: none
Severity: normal | Keywords:
------------------------+---------------------------------------------------
When creating a ndarray object on a 64 bit machine where the number of
bytes of data in the array is described by the following rule:
(size & 0x80000000) != 0 AND (size & 0xFFFFFFFF) != 0xFFFFFFFF
Accessing the data attribute (the data buffer) of the ndarray object
results in a ValueError exception.
Note the following examples:
{{{
thor> python
Python 2.5.1 (r251:54863, Jan 16 2008, 16:16:13)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__version__
'1.3.0.dev6306'
>>> a=numpy.zeros(0x7FFFFFFF,dtype='b1')
>>> a.data
<read-write buffer for 0xa054a0, size 2147483647, offset 0 at
0x2a99e13e70>
>>> a=numpy.zeros(0x80000000,dtype='b1')
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: size must be zero or positive
>>> a=numpy.zeros(0xFFFFFFFE,dtype='b1')
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: size must be zero or positive
>>> a=numpy.zeros(0xFFFFFFFF,dtype='b1')
>>> a.data
<read-write buffer for 0xa2e410, size -1, offset 0 at 0x2a99e13e30>
>>> a=numpy.zeros(0x180000000,dtype='b1')
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: size must be zero or positive
>>> a=numpy.zeros(0x180000001,dtype='b1')
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: size must be zero or positive
>>> a=numpy.zeros(0x1FFFFFFFF,dtype='b1')
>>> a.data
<read-write buffer for 0xa2e590, size -1, offset 0 at 0x2a99e13e70>
}}}
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/982>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list