I tend to use ndarray.copy() in python code -- no reason you couldn't do
the same in Cython.
If you want to take any array-like object that may not have a copy()
method, you could call asanyarray() first:
-CHB
On Sat, Nov 12, 2016 at 9:00 AM, Pavlyk, Oleksandr <
oleksandr.pav...@intel.com> w
Sat, 12 Nov 2016 17:00:07 +, Pavlyk, Oleksandr kirjoitti:
[clip]
> if x_arr is not x:
>in_place = 1 # a copy was made, so we can work in place.
>
> The logic is of the last line turns out to be incorrect, because the
> input x can be a class with an array interface.
Please see:
Hi,
In my Cython code a function processes it argument x as follows:
x_arr = PyArray_CheckFromAny(
x, NULL, 0, 0,
cnp.NPY_ELEMENTSTRIDES | cnp.NPY_ENSUREARRAY | cnp.NPY_NOTSWAPPED,
NULL)
if x_arr is not x:
in_place = 1 # a copy was made, so we can work in pla