diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-11-09 17:44:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-09 17:44:44 +0100 |
| commit | 62df7a80e79b7323f673f9b26c5f699325606466 (patch) | |
| tree | a05e50a34889772f62f05e8576f51caf3a2e39d2 /numpy | |
| parent | 2ce5416de6268dbecb69e797fe8b1e3c1d0b75c4 (diff) | |
| parent | e3db792974777527ec40d5c6caf88c503653da56 (diff) | |
| download | numpy-62df7a80e79b7323f673f9b26c5f699325606466.tar.gz | |
Merge pull request #22552 from juztamau5/fix-temp-address
MAINT: Do not use temporary struct construct
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/src/multiarray/dtype_transfer.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c index c588494e7..c07670488 100644 --- a/numpy/core/src/multiarray/dtype_transfer.c +++ b/numpy/core/src/multiarray/dtype_transfer.c @@ -2951,9 +2951,11 @@ _strided_to_strided_multistep_cast( if (castdata->from.func != NULL) { npy_intp out_stride = castdata->from.descriptors[1]->elsize; + char *const data[2] = {src, castdata->from_buffer}; + npy_intp strides[2] = {src_stride, out_stride}; if (castdata->from.func(&castdata->from.context, - (char *[2]){src, castdata->from_buffer}, &block_size, - (npy_intp [2]){src_stride, out_stride}, + data, &block_size, + strides, castdata->from.auxdata) != 0) { /* TODO: Internal buffer may require cleanup on error. */ return -1; @@ -2975,18 +2977,22 @@ _strided_to_strided_multistep_cast( main_dst_stride = dst_stride; } + char *const data[2] = {main_src, main_dst}; + npy_intp strides[2] = {main_src_stride, main_dst_stride}; if (castdata->main.func(&castdata->main.context, - (char *[2]){main_src, main_dst}, &block_size, - (npy_intp [2]){main_src_stride, main_dst_stride}, + data, &block_size, + strides, castdata->main.auxdata) != 0) { /* TODO: Internal buffer may require cleanup on error. */ return -1; } if (castdata->to.func != NULL) { + char *const data[2] = {main_dst, dst}; + npy_intp strides[2] = {main_dst_stride, dst_stride}; if (castdata->to.func(&castdata->to.context, - (char *[2]){main_dst, dst}, &block_size, - (npy_intp [2]){main_dst_stride, dst_stride}, + data, &block_size, + strides, castdata->to.auxdata) != 0) { return -1; } |
