8000 MAINT: Compute core_dim_ixs_size near where it is used · numpy/numpy@19ae9fb · GitHub
[go: up one dir, main page]

Skip to content

Commit 19ae9fb

Browse files
committed
MAINT: Compute core_dim_ixs_size near where it is used
1 parent e9fd6d4 commit 19ae9fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

numpy/core/src/umath/ufunc_object.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,6 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
22262226

22272227
/* Fill in op_axes for all the operands */
22282228
j = broadcast_ndim;
2229-
core_dim_ixs_size = 0;
22302229
for (i = 0; i < nop; ++i) {
22312230
int n;
22322231
if (op[i]) {
@@ -2268,7 +2267,6 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
22682267
}
22692268

22702269
op_axes[i] = op_axes_arrays[i];
2271-
core_dim_ixs_size += ufunc->core_num_dims[i];
22722270
}
22732271

22742272
/* Get the buffersize and errormask */
@@ -2383,6 +2381,10 @@ PyUFunc_GeneralizedFunction(PyUFuncObject *ufunc,
23832381
* Set up the inner strides array. Because we're not doing
23842382
* buffering, the strides are fixed throughout the looping.
23852383
*/
2384+
core_dim_ixs_size = 0;
2385+
for (i = 0; i < nop; ++i) {
2386+
core_dim_ixs_size += ufunc->core_num_dims[i];
2387+
}
23862388
inner_strides = (npy_intp *)PyArray_malloc(
23872389
NPY_SIZEOF_INTP * (nop+core_dim_ixs_size));
23882390
if (inner_strides == NULL) {

0 commit comments

Comments
 (0)
0