diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-06-04 22:02:06 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-06-05 22:32:11 -0700 |
commit | 5064f4a025bbf795017e1d7db6b5c080b10823dd (patch) | |
tree | 8a3cf4f50556636d5f108bca97d1ca60d85259ea /numpy | |
parent | a6e1e862c30f1ca5bf3b8d76c383a0853ecbddc3 (diff) | |
download | numpy-5064f4a025bbf795017e1d7db6b5c080b10823dd.tar.gz |
MAINT/STY: Line wrap PyArray_NewFromDescr consistently
Also move an assignment ouf of an if.
Only targeting calls that then go on to call PyArray_SetBaseObject
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/arrayobject.c | 11 | ||||
-rw-r--r-- | numpy/core/src/multiarray/arraytypes.c.src | 14 | ||||
-rw-r--r-- | numpy/core/src/multiarray/convert.c | 13 | ||||
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 44 | ||||
-rw-r--r-- | numpy/core/src/multiarray/einsum.c.src | 20 | ||||
-rw-r--r-- | numpy/core/src/multiarray/getset.c | 16 | ||||
-rw-r--r-- | numpy/core/src/multiarray/item_selection.c | 11 | ||||
-rw-r--r-- | numpy/core/src/multiarray/iterators.c | 6 | ||||
-rw-r--r-- | numpy/core/src/multiarray/mapping.c | 69 | ||||
-rw-r--r-- | numpy/core/src/multiarray/methods.c | 38 | ||||
-rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 9 | ||||
-rw-r--r-- | numpy/core/src/multiarray/nditer_api.c | 8 | ||||
-rw-r--r-- | numpy/core/src/multiarray/nditer_pywrap.c | 8 | ||||
-rw-r--r-- | numpy/core/src/multiarray/scalarapi.c | 4 | ||||
-rw-r--r-- | numpy/core/src/multiarray/shape.c | 33 | ||||
-rw-r--r-- | numpy/core/src/umath/reduction.c | 11 |
16 files changed, 150 insertions, 165 deletions
diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index e1db4d6f6..614022e61 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -1653,12 +1653,11 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) if (is_f_order) { buffer.flags |= NPY_ARRAY_F_CONTIGUOUS; } - ret = (PyArrayObject *)\ - PyArray_NewFromDescr_int(subtype, descr, - dims.len, dims.ptr, - strides.ptr, - offset + (char *)buffer.ptr, - buffer.flags, NULL, 0, 1); + ret = (PyArrayObject *)PyArray_NewFromDescr_int( + subtype, descr, + dims.len, dims.ptr, strides.ptr, offset + (char *)buffer.ptr, + buffer.flags, NULL, + 0, 1); if (ret == NULL) { descr = NULL; goto fail; diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index 48003e6a3..01b5654be 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -724,9 +724,10 @@ VOID_getitem(void *input, void *vap) return NULL; } Py_INCREF(descr->subarray->base); - ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - descr->subarray->base, shape.len, shape.ptr, - NULL, ip, PyArray_FLAGS(ap)&(~NPY_ARRAY_F_CONTIGUOUS), NULL); + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, descr->subarray->base, + shape.len, shape.ptr, NULL, ip, + PyArray_FLAGS(ap) & ~NPY_ARRAY_F_CONTIGUOUS, NULL); npy_free_cache_dim_obj(shape); if (!ret) { return NULL; @@ -923,9 +924,10 @@ VOID_setitem(PyObject *op, void *input, void *vap) return -1; } Py_INCREF(descr->subarray->base); - ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - descr->subarray->base, shape.len, shape.ptr, - NULL, ip, PyArray_FLAGS(ap), NULL); + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, descr->subarray->base, + shape.len, shape.ptr, NULL, ip, + PyArray_FLAGS(ap), NULL); npy_free_cache_dim_obj(shape); if (!ret) { return -1; diff --git a/numpy/core/src/multiarray/convert.c b/numpy/core/src/multiarray/convert.c index ca30d3f88..d7dac4f21 100644 --- a/numpy/core/src/multiarray/convert.c +++ b/numpy/core/src/multiarray/convert.c @@ -631,13 +631,12 @@ PyArray_View(PyArrayObject *self, PyArray_Descr *type, PyTypeObject *pytype) dtype = PyArray_DESCR(self); Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr_int(subtype, - dtype, - PyArray_NDIM(self), PyArray_DIMS(self), - PyArray_STRIDES(self), - PyArray_DATA(self), - flags, - (PyObject *)self, 0, 1); + ret = (PyArrayObject *)PyArray_NewFromDescr_int( + subtype, dtype, + PyArray_NDIM(self), PyArray_DIMS(self), PyArray_STRIDES(self), + PyArray_DATA(self), + flags, (PyObject *)self, + 0, 1); if (ret == NULL) { Py_XDECREF(type); return NULL; diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 70f5c72aa..f84e94b19 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -1349,9 +1349,10 @@ _array_from_buffer_3118(PyObject *memoryview) } flags = NPY_ARRAY_BEHAVED & (view->readonly ? ~NPY_ARRAY_WRITEABLE : ~0); - r = PyArray_NewFromDescr(&PyArray_Type, descr, - nd, shape, strides, view->buf, - flags, NULL); + r = PyArray_NewFromDescr( + &PyArray_Type, descr, + nd, shape, strides, view->buf, + flags, NULL); if (r == NULL) { goto fail; } @@ -2112,10 +2113,10 @@ PyArray_FromStructInterface(PyObject *input) } } - ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, thetype, - inter->nd, inter->shape, - inter->strides, inter->data, - inter->flags, NULL); + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, thetype, + inter->nd, inter->shape, inter->strides, inter->data, + inter->flags, NULL); Py_INCREF(input); if (PyArray_SetBaseObject(ret, input) < 0) { Py_DECREF(ret); @@ -2382,10 +2383,10 @@ PyArray_FromInterface(PyObject *origin) } } - ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, dtype, - n, dims, - NULL, data, - dataflags, NULL); + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, dtype, + n, dims, NULL, data, + dataflags, NULL); if (ret == NULL) { goto fail; } @@ -2898,11 +2899,11 @@ PyArray_Zeros(int nd, npy_intp *dims, PyArray_Descr *type, int is_f_order) type = PyArray_DescrFromType(NPY_DEFAULT_TYPE); } - ret = (PyArrayObject *)PyArray_NewFromDescr_int(&PyArray_Type, - type, - nd, dims, - NULL, NULL, - is_f_order, NULL, 1, 0); + ret = (PyArrayObject *)PyArray_NewFromDescr_int( + &PyArray_Type, type, + nd, dims, NULL, NULL, + is_f_order, NULL, + 1, 0); if (ret == NULL) { return NULL; @@ -3666,12 +3667,11 @@ PyArray_FromBuffer(PyObject *buf, PyArray_Descr *type, } } - if ((ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - type, - 1, &n, - NULL, data, - NPY_ARRAY_DEFAULT, - NULL)) == NULL) { + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, type, + 1, &n, NULL, data, + NPY_ARRAY_DEFAULT, NULL); + if (ret == NULL) { Py_DECREF(buf); return NULL; } diff --git a/numpy/core/src/multiarray/einsum.c.src b/numpy/core/src/multiarray/einsum.c.src index 3c086351f..358623bdc 100644 --- a/numpy/core/src/multiarray/einsum.c.src +++ b/numpy/core/src/multiarray/einsum.c.src @@ -2068,12 +2068,10 @@ get_single_op_view(PyArrayObject *op, int iop, char *labels, if (idim == ndim) { Py_INCREF(PyArray_DESCR(op)); *ret = (PyArrayObject *)PyArray_NewFromDescr( - Py_TYPE(op), - PyArray_DESCR(op), - ndim_output, new_dims, new_strides, - PyArray_DATA(op), - PyArray_ISWRITEABLE(op) ? NPY_ARRAY_WRITEABLE : 0, - (PyObject *)op); + Py_TYPE(op), PyArray_DESCR(op), + ndim_output, new_dims, new_strides, PyArray_DATA(op), + PyArray_ISWRITEABLE(op) ? NPY_ARRAY_WRITEABLE : 0, + (PyObject *)op); if (*ret == NULL) { return -1; @@ -2162,12 +2160,10 @@ get_combined_dims_view(PyArrayObject *op, int iop, char *labels) Py_INCREF(PyArray_DESCR(op)); ret = (PyArrayObject *)PyArray_NewFromDescr( - Py_TYPE(op), - PyArray_DESCR(op), - ndim, new_dims, new_strides, - PyArray_DATA(op), - PyArray_ISWRITEABLE(op) ? NPY_ARRAY_WRITEABLE : 0, - (PyObject *)op); + Py_TYPE(op), PyArray_DESCR(op), + ndim, new_dims, new_strides, PyArray_DATA(op), + PyArray_ISWRITEABLE(op) ? NPY_ARRAY_WRITEABLE : 0, + (PyObject *)op); if (ret == NULL) { return NULL; diff --git a/numpy/core/src/multiarray/getset.c b/numpy/core/src/multiarray/getset.c index d86f90a53..44a559d98 100644 --- a/numpy/core/src/multiarray/getset.c +++ b/numpy/core/src/multiarray/getset.c @@ -742,14 +742,14 @@ _get_part(PyArrayObject *self, int imag) Py_DECREF(type); type = new; } - ret = (PyArrayObject *) - PyArray_NewFromDescr(Py_TYPE(self), - type, - PyArray_NDIM(self), - PyArray_DIMS(self), - PyArray_STRIDES(self), - PyArray_BYTES(self) + offset, - PyArray_FLAGS(self), (PyObject *)self); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(self), + type, + PyArray_NDIM(self), + PyArray_DIMS(self), + PyArray_STRIDES(self), + PyArray_BYTES(self) + offset, + PyArray_FLAGS(self), (PyObject *)self); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index d010b2e75..845c33cbb 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -1876,13 +1876,10 @@ PyArray_Diagonal(PyArrayObject *self, int offset, int axis1, int axis2) /* Create the diagonal view */ dtype = PyArray_DTYPE(self); Py_INCREF(dtype); - ret = PyArray_NewFromDescr(Py_TYPE(self), - dtype, - ndim-1, ret_shape, - ret_strides, - data, - PyArray_FLAGS(self), - (PyObject *)self); + ret = PyArray_NewFromDescr( + Py_TYPE(self), dtype, + ndim-1, ret_shape, ret_strides, data, + PyArray_FLAGS(self), (PyObject *)self); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c index 723c565f0..9db0f32cc 100644 --- a/numpy/core/src/multiarray/iterators.c +++ b/numpy/core/src/multiarray/iterators.c @@ -1093,9 +1093,9 @@ iter_array(PyArrayIterObject *it, PyObject *NPY_UNUSED(op)) if (PyArray_ISCONTIGUOUS(it->ao)) { ret = (PyArrayObject *)PyArray_NewFromDescr( - &PyArray_Type, PyArray_DESCR(it->ao), 1, &size, - NULL, PyArray_DATA(it->ao), PyArray_FLAGS(it->ao), - (PyObject *)it->ao); + &PyArray_Type, PyArray_DESCR(it->ao), + 1, &size, NULL, PyArray_DATA(it->ao), + PyArray_FLAGS(it->ao), (PyObject *)it->ao); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index f2782ff27..3e18b4fc8 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -981,12 +981,11 @@ get_view_from_index(PyArrayObject *self, PyArrayObject **view, /* Create the new view and set the base array */ Py_INCREF(PyArray_DESCR(self)); *view = (PyArrayObject *)PyArray_NewFromDescr( - ensure_array ? &PyArray_Type : Py_TYPE(self), - PyArray_DESCR(self), - new_dim, new_shape, - new_strides, data_ptr, - PyArray_FLAGS(self), - ensure_array ? NULL : (PyObject *)self); + ensure_array ? &PyArray_Type : Py_TYPE(self), + PyArray_DESCR(self), + new_dim, new_shape, new_strides, data_ptr, + PyArray_FLAGS(self), + ensure_array ? NULL : (PyObject *)self); if (*view == NULL) { return -1; } @@ -1127,9 +1126,10 @@ array_boolean_subscript(PyArrayObject *self, PyArrayObject *tmp = ret; Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(self), dtype, 1, - &size, PyArray_STRIDES(ret), PyArray_BYTES(ret), - PyArray_FLAGS(self), (PyObject *)self); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(self), dtype, + 1, &size, PyArray_STRIDES(ret), PyArray_BYTES(ret), + PyArray_FLAGS(self), (PyObject *)self); if (ret == NULL) { Py_DECREF(tmp); @@ -1430,14 +1430,15 @@ _get_field_view(PyArrayObject *arr, PyObject *ind, PyArrayObject **view) /* view the array at the new offset+dtype */ Py_INCREF(fieldtype); *view = (PyArrayObject*)PyArray_NewFromDescr_int( - Py_TYPE(arr), - fieldtype, - PyArray_NDIM(arr), - PyArray_SHAPE(arr), - PyArray_STRIDES(arr), - PyArray_BYTES(arr) + offset, - PyArray_FLAGS(arr), - (PyObject *)arr, 0, 1); + Py_TYPE(arr), + fieldtype, + PyArray_NDIM(arr), + PyArray_SHAPE(arr), + PyArray_STRIDES(arr), + PyArray_BYTES(arr) + offset, + PyArray_FLAGS(arr), + (PyObject *)arr, + 0, 1); if (*view == NULL) { return 0; } @@ -1557,14 +1558,15 @@ _get_field_view(PyArrayObject *arr, PyObject *ind, PyArrayObject **view) view_dtype->flags = PyArray_DESCR(arr)->flags; *view = (PyArrayObject*)PyArray_NewFromDescr_int( - Py_TYPE(arr), - view_dtype, - PyArray_NDIM(arr), - PyArray_SHAPE(arr), - PyArray_STRIDES(arr), - PyArray_DATA(arr), - PyArray_FLAGS(arr), - (PyObject *)arr, 0, 1); + Py_TYPE(arr), + view_dtype, + PyArray_NDIM(arr), + PyArray_SHAPE(arr), + PyArray_STRIDES(arr), + PyArray_DATA(arr), + PyArray_FLAGS(arr), + (PyObject *)arr, + 0, 1); if (*view == NULL) { return 0; } @@ -1772,14 +1774,15 @@ array_subscript(PyArrayObject *self, PyObject *op) PyArrayObject *tmp_arr = (PyArrayObject *)result; Py_INCREF(PyArray_DESCR(tmp_arr)); - result = PyArray_NewFromDescr(Py_TYPE(self), - PyArray_DESCR(tmp_arr), - PyArray_NDIM(tmp_arr), - PyArray_SHAPE(tmp_arr), - PyArray_STRIDES(tmp_arr), - PyArray_BYTES(tmp_arr), - PyArray_FLAGS(self), - (PyObject *)self); + result = PyArray_NewFromDescr( + Py_TYPE(self), + PyArray_DESCR(tmp_arr), + PyArray_NDIM(tmp_arr), + PyArray_SHAPE(tmp_arr), + PyArray_STRIDES(tmp_arr), + PyArray_BYTES(tmp_arr), + PyArray_FLAGS(self), + (PyObject *)self); if (result == NULL) { Py_DECREF(tmp_arr); diff --git a/numpy/core/src/multiarray/methods.c b/numpy/core/src/multiarray/methods.c index ed339b98d..ef1b27ba0 100644 --- a/numpy/core/src/multiarray/methods.c +++ b/numpy/core/src/multiarray/methods.c @@ -373,13 +373,13 @@ PyArray_GetField(PyArrayObject *self, PyArray_Descr *typed, int offset) Py_DECREF(safe); } - ret = PyArray_NewFromDescr_int(Py_TYPE(self), - typed, - PyArray_NDIM(self), PyArray_DIMS(self), - PyArray_STRIDES(self), - PyArray_BYTES(self) + offset, - PyArray_FLAGS(self)&(~NPY_ARRAY_F_CONTIGUOUS), - (PyObject *)self, 0, 1); + ret = PyArray_NewFromDescr_int( + Py_TYPE(self), typed, + PyArray_NDIM(self), PyArray_DIMS(self), PyArray_STRIDES(self), + PyArray_BYTES(self) + offset, + PyArray_FLAGS(self) & ~NPY_ARRAY_F_CONTIGUOUS, + (PyObject *)self, + 0, 1); if (ret == NULL) { return NULL; } @@ -880,12 +880,13 @@ array_wraparray(PyArrayObject *self, PyObject *args) if (Py_TYPE(self) != Py_TYPE(arr)){ PyArray_Descr *dtype = PyArray_DESCR(arr); Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(self), - dtype, - PyArray_NDIM(arr), - PyArray_DIMS(arr), - PyArray_STRIDES(arr), PyArray_DATA(arr), - PyArray_FLAGS(arr), (PyObject *)self); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(self), + dtype, + PyArray_NDIM(arr), + PyArray_DIMS(arr), + PyArray_STRIDES(arr), PyArray_DATA(arr), + PyArray_FLAGS(arr), (PyObject *)self); if (ret == NULL) { return NULL; } @@ -931,12 +932,11 @@ array_preparearray(PyArrayObject *self, PyObject *args) dtype = PyArray_DESCR(arr); Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(self), - dtype, - PyArray_NDIM(arr), - PyArray_DIMS(arr), - PyArray_STRIDES(arr), PyArray_DATA(arr), - PyArray_FLAGS(arr), (PyObject *)self); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(self), dtype, + PyArray_NDIM(arr), PyArray_DIMS(arr), PyArray_STRIDES(arr), + PyArray_DATA(arr), + PyArray_FLAGS(arr), (PyObject *)self); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index 896a3b07e..d128aa5f9 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -1629,11 +1629,10 @@ _prepend_ones(PyArrayObject *arr, int nd, int ndmin, NPY_ORDER order) } dtype = PyArray_DESCR(arr); Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(arr), - dtype, ndmin, newdims, newstrides, - PyArray_DATA(arr), - PyArray_FLAGS(arr), - (PyObject *)arr); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(arr), dtype, + ndmin, newdims, newstrides, PyArray_DATA(arr), + PyArray_FLAGS(arr), (PyObject *)arr); if (ret == NULL) { Py_DECREF(arr); return NULL; diff --git a/numpy/core/src/multiarray/nditer_api.c b/numpy/core/src/multiarray/nditer_api.c index 28020f79a..c323cbb2d 100644 --- a/numpy/core/src/multiarray/nditer_api.c +++ b/numpy/core/src/multiarray/nditer_api.c @@ -1140,10 +1140,10 @@ NpyIter_GetIterView(NpyIter *iter, npy_intp i) } Py_INCREF(dtype); - view = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, dtype, ndim, - shape, strides, dataptr, - writeable ? NPY_ARRAY_WRITEABLE : 0, - NULL); + view = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, dtype, + ndim, shape, strides, dataptr, + writeable ? NPY_ARRAY_WRITEABLE : 0, NULL); if (view == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/nditer_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c index 50a138167..0fdad315e 100644 --- a/numpy/core/src/multiarray/nditer_pywrap.c +++ b/numpy/core/src/multiarray/nditer_pywrap.c @@ -2064,10 +2064,10 @@ npyiter_seq_item(NewNpyArrayIterObject *self, Py_ssize_t i) } Py_INCREF(dtype); - ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, dtype, - ret_ndim, &innerloopsize, - &innerstride, dataptr, - self->writeflags[i] ? NPY_ARRAY_WRITEABLE : 0, NULL); + ret = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, dtype, + ret_ndim, &innerloopsize, &innerstride, dataptr, + self->writeflags[i] ? NPY_ARRAY_WRITEABLE : 0, NULL); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/multiarray/scalarapi.c b/numpy/core/src/multiarray/scalarapi.c index 1941f849f..a3fd9333c 100644 --- a/numpy/core/src/multiarray/scalarapi.c +++ b/numpy/core/src/multiarray/scalarapi.c @@ -290,8 +290,8 @@ PyArray_FromScalar(PyObject *scalar, PyArray_Descr *outcode) if ((typecode->type_num == NPY_VOID) && !(((PyVoidScalarObject *)scalar)->flags & NPY_ARRAY_OWNDATA) && outcode == NULL) { - r = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, - typecode, + r = (PyArrayObject *)PyArray_NewFromDescr( + &PyArray_Type, typecode, 0, NULL, NULL, ((PyVoidScalarObject *)scalar)->obval, ((PyVoidScalarObject *)scalar)->flags, diff --git a/numpy/core/src/multiarray/shape.c b/numpy/core/src/multiarray/shape.c index 1424a69f3..185f90935 100644 --- a/numpy/core/src/multiarray/shape.c +++ b/numpy/core/src/multiarray/shape.c @@ -267,12 +267,11 @@ PyArray_Newshape(PyArrayObject *self, PyArray_Dims *newdims, } Py_INCREF(PyArray_DESCR(self)); - ret = (PyArrayObject *)PyArray_NewFromDescr_int(Py_TYPE(self), - PyArray_DESCR(self), - ndim, dimensions, - strides, - PyArray_DATA(self), - flags, (PyObject *)self, 0, 1); + ret = (PyArrayObject *)PyArray_NewFromDescr_int( + Py_TYPE(self), PyArray_DESCR(self), + ndim, dimensions, strides, PyArray_DATA(self), + flags, (PyObject *)self, + 0, 1); if (ret == NULL) { goto fail; @@ -714,13 +713,10 @@ PyArray_Transpose(PyArrayObject *ap, PyArray_Dims *permute) * incorrectly), sets up descr, and points data at PyArray_DATA(ap). */ Py_INCREF(PyArray_DESCR(ap)); - ret = (PyArrayObject *) - PyArray_NewFromDescr(Py_TYPE(ap), - PyArray_DESCR(ap), - n, PyArray_DIMS(ap), - NULL, PyArray_DATA(ap), - flags, - (PyObject *)ap); + ret = (PyArrayObject *) PyArray_NewFromDescr( + Py_TYPE(ap), PyArray_DESCR(ap), + n, PyArray_DIMS(ap), NULL, PyArray_DATA(ap), + flags, (PyObject *)ap); if (ret == NULL) { return NULL; } @@ -954,13 +950,10 @@ PyArray_Ravel(PyArrayObject *arr, NPY_ORDER order) val[0] = PyArray_SIZE(arr); Py_INCREF(PyArray_DESCR(arr)); - ret = (PyArrayObject *)PyArray_NewFromDescr(Py_TYPE(arr), - PyArray_DESCR(arr), - 1, val, - &stride, - PyArray_BYTES(arr), - PyArray_FLAGS(arr), - (PyObject *)arr); + ret = (PyArrayObject *)PyArray_NewFromDescr( + Py_TYPE(arr), PyArray_DESCR(arr), + 1, val, &stride, PyArray_BYTES(arr), + PyArray_FLAGS(arr), (PyObject *)arr); if (ret == NULL) { return NULL; } diff --git a/numpy/core/src/umath/reduction.c b/numpy/core/src/umath/reduction.c index 5c3a84e21..69d8fd2dd 100644 --- a/numpy/core/src/umath/reduction.c +++ b/numpy/core/src/umath/reduction.c @@ -155,13 +155,10 @@ conform_reduce_result(int ndim, npy_bool *axis_flags, dtype = PyArray_DESCR(out); Py_INCREF(dtype); - ret = (PyArrayObject_fields *)PyArray_NewFromDescr(&PyArray_Type, - dtype, - ndim, shape, - strides, - PyArray_DATA(out), - PyArray_FLAGS(out), - NULL); + ret = (PyArrayObject_fields *)PyArray_NewFromDescr( + &PyArray_Type, dtype, + ndim, shape, strides, PyArray_DATA(out), + PyArray_FLAGS(out), NULL); if (ret == NULL) { return NULL; } |