Skip to content

Commit 3899d9c

Browse files
authored
Merge pull request numpy#19944 from DimitriPapadopoulos/lgtm_warning_PyArray_CopyAsFlat
MAINT: Fix LGTM.com warning: Comparison result is always the same (`res`)
2 parents a856eb5 + 580bbdf commit 3899d9c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

numpy/core/src/multiarray/ctors.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,7 +2717,7 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order)
27172717
/* If we exhausted the dst block, refresh it */
27182718
if (dst_count == count) {
27192719
res = dst_iternext(dst_iter);
2720-
if (!res) {
2720+
if (res == 0) {
27212721
break;
27222722
}
27232723
dst_count = *dst_countptr;
@@ -2731,7 +2731,7 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order)
27312731
/* If we exhausted the src block, refresh it */
27322732
if (src_count == count) {
27332733
res = src_iternext(src_iter);
2734-
if (!res) {
2734+
if (res == 0) {
27352735
break;
27362736
}
27372737
src_count = *src_countptr;
@@ -2748,10 +2748,6 @@ PyArray_CopyAsFlat(PyArrayObject *dst, PyArrayObject *src, NPY_ORDER order)
27482748
NPY_cast_info_xfree(&cast_info);
27492749
NpyIter_Deallocate(dst_iter);
27502750
NpyIter_Deallocate(src_iter);
2751-
if (res > 0) {
2752-
/* The iteration stopped successfully, do not report an error */
2753-
return 0;
2754-
}
27552751
return res;
27562752
}
27572753

0 commit comments

Comments
 (0)