diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 14:42:52 +0100 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-07-22 14:42:52 +0100 |
commit | b56c42e10a2dd9f7028acd18d2904c65c3b24396 (patch) | |
tree | c629c38deba3fd1614c7afa8be00797a554f653e | |
parent | a52634d7ea38f74ba286580f96c35190b2b3b549 (diff) | |
download | numpy-b56c42e10a2dd9f7028acd18d2904c65c3b24396.tar.gz |
MAINT: Improve variable names and scope in discover_dimensions
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 7367902cc..2e2157eef 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -846,11 +846,10 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it, return 0; } else { - npy_intp dtmp[NPY_MAXDIMS]; - int j, maxndim_m1 = *maxndim - 1; - e = PySequence_Fast_GET_ITEM(seq, 0); + int maxndim_m1 = *maxndim - 1; + PyObject *first = PySequence_Fast_GET_ITEM(seq, 0); - r = discover_dimensions(e, &maxndim_m1, d + 1, check_it, + r = discover_dimensions(first, &maxndim_m1, d + 1, check_it, stop_at_string, stop_at_tuple, out_is_object); if (r < 0) { @@ -861,9 +860,12 @@ discover_dimensions(PyObject *obj, int *maxndim, npy_intp *d, int check_it, /* For the dimension truncation check below */ *maxndim = maxndim_m1 + 1; for (i = 1; i < n; ++i) { - e = PySequence_Fast_GET_ITEM(seq, i); + int j; + npy_intp dtmp[NPY_MAXDIMS]; + PyObject *elem = PySequence_Fast_GET_ITEM(seq, i); + /* Get the dimensions of the first item */ - r = discover_dimensions(e, &maxndim_m1, dtmp, check_it, + r = discover_dimensions(elem, &maxndim_m1, dtmp, check_it, stop_at_string, stop_at_tuple, out_is_object); if (r < 0) { |