-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix build warnings #27157
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
Merged
Fix build warnings #27157
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d41edd5
CLN: fix build warning
pilkibun 160b55d
CLN: fix build warning
pilkibun a6a252a
CLN: fix build warning
pilkibun 125c97a
CLN: fix build warning
pilkibun 0931a1a
CLN: fix build warning
pilkibun 50f819b
CLN: fix build warning
pilkibun ca7d77c
CLN: fix build warning
pilkibun 75537d9
CLN: fix build warning
pilkibun 168462d
CLN: fix build warning
pilkibun 913956d
CLN: fix build warning
pilkibun 6554425
CLN: fix build warning
pilkibun 7e9117b
CLN: fix build warning
pilkibun d2440ef
Revert "CLN: fix build warning"
pilkibun 08b9606
CLN: fix build warning
pilkibun 9db4c05
CLN: fix test
pilkibun d914206
CEC8
pilkibun 71c7d62
CLN: use snprintf not strncpy to silence both compiler and cpplint
pilkibun d2e8f66
Use Py_ssize_t not ssize_t
pilkibun ac4c0b3
omit template changes
pilkibun 832d55d
Retry CI
pilkibun 790a8e7
use Py_ssize_t
pilkibun 71b4df0
remove redundant sizeof
pilkibun e464800
Use memory views without specific memory layout
pilkibun d8f3fa5
BUG: check for empty values in index.pyx/_bin_search
pilkibun 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.
This is a real bug I think.
mid
is referenced in the return value iflen(values)=1
so that the main loop immediately falls through.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.
So this would fail if
len(values) == 0
right? Do you see a code sample to actually trigger that?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.
quite possibly this is meant to be "caller checks". But that's out of the compiler's view.
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.
Yea sure. Similar comment though - good to suppress compiler warning but if there's an actual error here (which I think would still happen without the warning) would be good to address
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.
if
values
is empty, the loop falls through,util.get_value_at(values, mid)
gets called, which callsvalidate_indexer
which raises. I think it's ok.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.
cython code can have weird corner cases where exceptions get ignored. Adding a test for this case seems worthwhile.
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.
interesting. example?
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.
huh. I think you've nailed something here. So it's not exactly weird corner cases, but cdef functions which return exception as if they were python functions.
https://cython.readthedocs.io/en/latest/src/userguide/language_basics.html#error-return-values
validate_indexer
andget_value_at
are both cdef. validate_indexer is taggedexcept -1
, so any exception translates into a -1 retval. But the callerget_value_at
doesn't check that and uses -1 to reference into the the array. in this case an empty one. but it doesn't have an except return value defines. So, I'm not sure what happens.OTOH, the index constructor refuses to create empty indexes, so an end-to-end test does not seem possible. and
get_value_at
is used all over the place.Hmm. will have to think about this.
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.
very interesting bug.