8000 MAINT: Minor fixes and cleanups · numpy/numpy@16d201b · GitHub
[go: up one dir, main page]

Skip to content

Commit 16d201b

Browse files
sebergcharris
authored andcommitted
MAINT: Minor fixes and cleanups
1 parent 1bb40d4 commit 16d201b

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

numpy/core/src/multiarray/dtype_transfer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,7 @@ get_decsrcref_transfer_function(int aligned,
33373337
/* If there are subarrays, need to wrap it */
33383338
else if (PyDataType_HASSUBARRAY(src_dtype)) {
33393339
PyArray_Dims src_shape = {NULL, -1};
3340-
npy_intp src_size = 1;
3340+
npy_intp src_size;
33413341
PyArray_StridedUnaryOp *stransfer;
33423342
NpyAuxData *data;
33433343

numpy/core/src/multiarray/iterators.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,6 @@ iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val)
830830
if (check_and_adjust_index(&start, self->size, -1, NULL) < 0) {
831831
goto finish;
832832
}
833-
retval = 0;
834833
PyArray_ITER_GOTO1D(self, start);
835834
retval = type->f->setitem(val, self->dataptr, self->ao);
836835
PyArray_ITER_RESET(self);

numpy/core/src/multiarray/multiarraymodule.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,8 @@ _array_fromobject(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws)
15811581
PyArrayObject *oparr = NULL, *ret = NULL;
15821582
npy_bool subok = NPY_FALSE;
15831583
npy_bool copy = NPY_TRUE;
1584-
int ndmin = 0, nd;
1584+
int nd;
1585+
npy_intp ndmin = 0;
15851586
PyArray_Descr *type = NULL;
15861587
PyArray_Descr *oldtype = NULL;
15871588
NPY_ORDER order = NPY_KEEPORDER;
@@ -1652,12 +1653,10 @@ _array_fromobject(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws)
16521653
}
16531654
}
16541655

1655-
/* copy=False with default dtype, order and ndim */
1656-
if (STRIDING_OK(oparr, order)) {
1657-
ret = oparr;
1658-
Py_INCREF(ret);
1659-
goto finish;
1660-
}
1656+
/* copy=False with default dtype, order (any is OK) and ndim */
1657+
ret = oparr;
1658+
Py_INCREF(ret);
1659+
goto finish;
16611660
}
16621661
}
16631662

numpy/core/src/multiarray/nditer_api.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,15 +1628,12 @@ npyiter_coalesce_axes(NpyIter *iter)
16281628
npy_intp istrides, nstrides = NAD_NSTRIDES();
16291629
NpyIter_AxisData *axisdata = NIT_AXISDATA(iter);
16301630
npy_intp sizeof_axisdata = NIT_AXISDATA_SIZEOF(itflags, ndim, nop);
1631-
NpyIter_AxisData *ad_compress;
1631+
NpyIter_AxisData *ad_compress = axisdata;
16321632
npy_intp new_ndim = 1;
16331633

16341634
/* The HASMULTIINDEX or IDENTPERM flags do not apply after coalescing */
16351635
NIT_ITFLAGS(iter) &= ~(NPY_ITFLAG_IDENTPERM|NPY_ITFLAG_HASMULTIINDEX);
16361636

1637-
axisdata = NIT_AXISDATA(iter);
1638-
ad_compress = axisdata;
1639-
16401637
for (idim = 0; idim < ndim-1; ++idim) {
16411638
int can_coalesce = 1;
16421639
npy_intp shape0 = NAD_SHAPE(ad_compress);

numpy/core/src/umath/ufunc_object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4146,7 +4146,7 @@ PyUFunc_Reduceat(PyUFuncObject *ufunc, PyArrayObject *arr, PyArrayObject *ind,
41464146
#endif
41474147

41484148
/* Set up the op_axes for the outer loop */
4149-
for (i = 0, idim = 0; idim < ndim; ++idim) {
4149+
for (idim = 0; idim < ndim; ++idim) {
41504150
/* Use the i-th iteration dimension to match up ind */
41514151
if (idim == axis) {
41524152
op_axes_arrays[0][idim] = axis;

0 commit comments

Comments
 (0)
0