File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
numpy/core/src/multiarray Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -3582,6 +3582,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
3582
3582
PyArray_ISNBO (dst_dtype -> byteorder )) {
3583
3583
3584
3584
if (PyArray_EquivTypenums (src_type_num , dst_type_num )) {
3585
+ /*
3586
+ * For complex numbers, the alignment is smaller than the
3587
+ * type size, so we turn off the aligned flag then.
3588
+ */
3589
+ if (src_dtype -> kind == 'c' || dst_dtype -> kind == 'c' ) {
3590
+ aligned = 0 ;
3591
+ }
3585
3592
* out_stransfer = PyArray_GetStridedCopyFn (aligned ,
3586
3593
src_stride , dst_stride ,
3587
3594
src_itemsize );
@@ -3678,6 +3685,13 @@ PyArray_GetDTypeTransferFunction(int aligned,
3678
3685
/* This is a straight copy */
3679
3686
if (src_itemsize == 1 || PyArray_ISNBO (src_dtype -> byteorder ) ==
3680
3687
PyArray_ISNBO (dst_dtype -> byteorder )) {
3688
+ /*
3689
+ * For complex numbers, the alignment is smaller than the
3690
+ * type size, so we turn off the aligned flag then.
3691
+ */
3692
+ if (src_dtype -> kind == 'c' || dst_dtype -> kind == 'c' ) {
3693
+ aligned = 0 ;
3694
+ }
3681
3695
* out_stransfer = PyArray_GetStridedCopyFn (aligned ,
3682
3696
src_stride , dst_stride ,
3683
3697
src_itemsize );
You can’t perform that action at this time.
0 commit comments