summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2021-09-24 12:16:59 -0600
committerGitHub <noreply@github.com>2021-09-24 12:16:59 -0600
commit3899d9cdd215399951330f0b49526e36cbad1c0c (patch)
tree4198448c99bb482320d076e5e5d3a513d86d4de0 /numpy
parenta856eb539fc265e0971c89099b303ca77f75c006 (diff)
parent580bbdfe48327ec3c36bf33faeb9d0c53658dfb0 (diff)
downloadnumpy-3899d9cdd215399951330f0b49526e36cbad1c0c.tar.gz
Merge pull request #19944 from DimitriPapadopoulos/lgtm_warning_PyArray_CopyAsFlat
MAINT: Fix LGTM.com warning: Comparison result is always the same (`res`)
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/ctors.c8
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;
}