diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 14:47:51 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 14:47:51 +0100 |
commit | 486a764c08c24ccba0d4baad901378112a9eec88 (patch) | |
tree | c8fcc8be5088908447f9795251b5ec1f559055ee /numpy/core | |
parent | b56c42e10a2dd9f7028acd18d2904c65c3b24396 (diff) | |
download | numpy-486a764c08c24ccba0d4baad901378112a9eec88.tar.gz |
MAINT: Eliminate intermediate variable for consistency
Also tidy line-wrapping
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 2e2157eef..4602245de 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -666,7 +666,6 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it, int *out_is_object) { PyObject *e; - int r; npy_intp n, i; Py_buffer buffer_view; PyObject * seq; @@ -849,12 +848,11 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it, int maxndim_m1 = *maxndim - 1; PyObject *first = PySequence_Fast_GET_ITEM(seq, 0); - r = discover_dimensions(first, &maxndim_m1, d + 1, check_it, - stop_at_string, stop_at_tuple, - out_is_object); - if (r < 0) { + if (discover_dimensions( + first, &maxndim_m1, d + 1, check_it, + stop_at_string, stop_at_tuple, out_is_object) < 0) { Py_DECREF(seq); - return r; + return -1; } /* For the dimension truncation check below */ @@ -864,13 +862,12 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it, npy_intp dtmp[NPY_MAXDIMS]; PyObject *elem = PySequence_Fast_GET_ITEM(seq, i); - /* Get the dimensions of the first item */ - r = discover_dimensions(elem, &maxndim_m1, dtmp, check_it, - stop_at_string, stop_at_tuple, - out_is_object); - if (r < 0) { + /* Get the dimensions of the remaining items */ + if (discover_dimensions( + elem, &maxndim_m1, dtmp, check_it, + stop_at_string, stop_at_tuple, out_is_object) < 0) { Py_DECREF(seq); - return r; + return -1; } /* Reduce max_ndim_m1 to just items which match */ @@ -1706,9 +1703,9 @@ PyArray_GetArrayParamsFromObject(PyObject *op, *out_ndim = NPY_MAXDIMS; is_object = 0; - if (discover_dimensions(op, out_ndim, out_dims, check_it, - stop_at_string, stop_at_tuple, - &is_object) < 0) { + if (discover_dimensions( + op, out_ndim, out_dims, check_it, + stop_at_string, stop_at_tuple, &is_object) < 0) { Py_DECREF(*out_dtype); if (PyErr_Occurred()) { return -1; |