-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
MAINT Remove -Wsign-compare warnings when compiling sklearn.neighbors._quad_tree #25271
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
Merged
glemaitre
merged 2 commits into
scikit-learn:main
from
OmarManzoor:cython_quad_tree_wsign_compare
Jan 14, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Another alternative which is:
but I think what you chose brings a correct conversion:
capacity
isSIZE_t
AKAcnp.npy_intp
AKAPy_intptr_t
AKA "an integer that is the size of a pointer on the platform" whilst,SIZE_MAX
is the maximum value foruint64
stored as auint64
I suppose.I find using
SIZE_MAX
for this encoding weird. Would there be configuration for which this would break? Previously, wascapacity
cast to asize_t
(likely auint64
on most architecture nowadays) or wasSIZE_MAX
cast to aPy_intptr_t
?@OmarManzoor: can you provide the warning you get on your platform?
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 the precise warning:
sklearn/neighbors/_quad_tree.c:8389:34: warning: comparison of integers of different signs: '__pyx_t_7sklearn_9neighbors_10_quad_tree_SIZE_t' (aka 'long') and 'unsigned long' [-Wsign-compare] __pyx_t_1 = ((__pyx_v_capacity == SIZE_MAX) != 0);