File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
numpy/core/src/multiarray Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2689,6 +2689,28 @@ PyArray_CopyInto(PyArrayObject *dst, PyArrayObject *src)
2689
2689
if ((dst_base != NULL && PyCphVB_ARRAY (dst_base ) != NULL ) ||
2690
2690
(src_base != NULL && PyCphVB_ARRAY (src_base ) != NULL ))
2691
2691
{
2692
+ //In order to make sure that the two array shapes match
2693
+ //we create a new iterator.
2694
+ PyArrayObject * op [2 ];
2695
+ npy_uint32 op_flags [2 ];
2696
+ NpyIter * iter ;
2697
+ op [0 ] = dst ;
2698
+ op [1 ] = src ;
2699
+ op_flags [0 ] = NPY_ITER_WRITEONLY ;
2700
+ op_flags [1 ] = NPY_ITER_READONLY ;
2701
+ iter = NpyIter_MultiNew (2 , op ,
2702
+ NPY_ITER_EXTERNAL_LOOP |
2703
+ NPY_ITER_REFS_OK |
2704
+ NPY_ITER_ZEROSIZE_OK ,
2705
+ NPY_KEEPORDER ,
2706
+ NPY_NO_CASTING ,
2707
+ op_flags ,
2708
+ NULL );
2709
+ if (iter == NULL )
2710
+ return -1 ;
2711
+ else
2712
+ NpyIter_Deallocate (iter );
2713
+
2692
2714
int cphret = PyCphVB_CopyInto (dst , src );
2693
2715
if (cphret != 1 )//PyCphVB_CopyInto() was performed.
2694
2716
return cphret ;
You can’t perform that action at this time.
0 commit comments