-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
MAINT: Correct code producing warnings #18432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
These produce warnings when building using clang-cl on Windows. Two are just casts. The other appears to be the wrong function for the input (labs -> llabs). |
Failure is due to coverage, not being wrong. |
numpy/core/src/multiarray/ctors.c
Outdated
@@ -2907,7 +2907,7 @@ _arange_safe_ceil_to_intp(double value) | |||
"arange: cannot compute length"); | |||
return -1; | |||
} | |||
if (!(NPY_MIN_INTP <= ivalue && ivalue <= NPY_MAX_INTP)) { | |||
if (!(NPY_MIN_INTP <= ivalue && ivalue <= (double)NPY_MAX_INTP)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is strange: shouldn't you need to cast both NPY_MIN_INTP
and NPY_MAX_INTP
?
It doesn't complain about NPY_MIN_INTP, just NPY_MAX_INTP. Could the double representation of NPY_MIN_INTP is exact?
|
Cast to avoid warnings Correct function
5cf2bad
to
e2467e4
Compare
I think even if it does not currently emit a warning it would be better to pre-emptively add a cast to |
Easy enough to add. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once CI passes
@mattip all green except coverage delta which is unavoidable. |
Thanks @bashtage |
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Add optimization Revert changes for warnings awaiting numpy#18432 Small clean up of commented code
Cast to avoid warnings
Correct function