diff options
author | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-09-24 14:04:34 +0200 |
---|---|---|
committer | Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> | 2021-09-24 19:06:16 +0200 |
commit | 580bbdfe48327ec3c36bf33faeb9d0c53658dfb0 (patch) | |
tree | 603771c47a285dea709c98166d606ed41caae714 /numpy | |
parent | 0cf5bc092f801a4c004ecdb7d1061f46aaab4ff4 (diff) | |
download | numpy-580bbdfe48327ec3c36bf33faeb9d0c53658dfb0.tar.gz |
MAINT: Fix LGTM.com warning
Comparison result is always the same
Comparison is always false because res <= 0.
Indeed the for(;;) iteration may stop on 3 different breaks:
res = -1;
break;
if (!res) {
break;
if (!res) {
break;
Therefore, after the loop, the only possible values for res are -1 and 0,
and (res > 0) is always false.
This originates in 37dc69c (#17029).
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 04be45f00..9da75fb8a 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -2717,7 +2717,7 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order) /* If we exhausted the dst block, refresh it */ if (dst_count == count) { res = dst_iternext(dst_iter); - if (!res) { + if (res == 0) { break; } dst_count = *dst_countptr; @@ -2731,7 +2731,7 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order) /* If we exhausted the src block, refresh it */ if (src_count == count) { res = src_iternext(src_iter); - if (!res) { + if (res == 0) { break; } src_count = *src_countptr; @@ -2748,10 +2748,6 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order) NPY_cast_info_xfree(&cast_info); NpyIter_Deallocate(dst_iter); NpyIter_Deallocate(src_iter); - if (res > 0) { - /* The iteration stopped successfully, do not report an error */ - return 0; - } return res; } |