[pypy-dev] numpypy buffer interface for slices different from numpy
Kay F. Jahnke
_kfj at yahoo.com
Tue Apr 23 17:12:55 CEST 2013
Hi group!
I stumbled upon a difference in numpypy's ndarray buffer interface. If I
take the address of the data of a slice in numpy, I get a pointer to the
first element in the slice. In numpypy I get a pointer to the data I
took the slice from. I wonder if this is a bug or deliberate? If it's a
bug, it's probably merely an omission of adding the offset to the data
pointer. Here's what I observed:
$ pypy
Python 2.7.3 (aa7b56060ddd, Apr 22 2013, 22:03:12)
[PyPy 2.0.0-beta2 with GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``PyPy 1.2 released -
http://pypy.org/''
>>>> import numpypy as np
>>>> a=np.zeros(10)
>>>> a.__array_interface__['data'][0]
-1220095968
>>>> a[2:].__array_interface__['data'][0]
-1220095968 <<<<<<<< same value
$ python
Python 2.7.3 (default, Apr 10 2013, 05:46:21)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> a=np.zeros(10)
>>> a.__array_interface__['data'][0]
162282152
>>> a[2:].__array_interface__['data'][0]
162282168 <<<<<<<<<<< different value
with regards
Kay F. Jahnke
More information about the pypy-dev
mailing list