[pypy-issue] [issue1537] numpypy array slicing doesn't update data memory address
mikefc
tracker at bugs.pypy.org
Sun Jul 14 12:46:43 CEST 2013
New submission from mikefc <coolbutuseless at gmail.com>:
If a slice is taken out of a numpypy ndarray, then the array_interface['data'] value is
not updated to point to the start of the actual memory of the slice. Instead, it still
points to the start of the memory of the parent array.
Code below illustrates that cpython/numpy update the array interface, whereas
pypy/numpypy does not.
#---------------------------------------------------
# code
#---------------------------------------------------
try:
import numpypy as np
except:
import numpy as np
zz = np.array(range(9))
print zz.__array_interface__['data']
print zz[0:3].__array_interface__['data']
print zz[3:5].__array_interface__['data']
#---------------------------------------------------
# cpython 2.7.4
#---------------------------------------------------
(140287077459744, False) # start of zz array
(140287077459744, False) # correctly pointing to start of zz memory
(140287077459768, False) # pointing to start of third element of zz
#---------------------------------------------------
# latest nightly OSX
#---------------------------------------------------
(4340424752, False)
(4340424752, False)
(4340424752, False) # Still pointing to start of zz array memory!
----------
messages: 5925
nosy: mikefc, pypy-issue
priority: bug
status: unread
title: numpypy array slicing doesn't update data memory address
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1537>
________________________________________
More information about the pypy-issue
mailing list