-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Fix build warnings #27157
Changes from all commits
d41edd5
160b55d
a6a252a
125c97a
0931a1a
50f819b
ca7d77c
75537d9
168462d
913956d
6554425
7e9117b
d2440ef
08b9606
9db4c05
d914206
71c7d62
d2e8f66
ac4c0b3
832d55d
790a8e7
71b4df0
e464800
d8f3fa5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -352,10 +352,10 @@ cdef class IndexEngine: | |
|
||
cdef Py_ssize_t _bin_search(ndarray values, object val) except -1: | ||
cdef: | ||
Py_ssize_t mid, lo = 0, hi = len(values) - 1 | ||
Py_ssize_t mid = 0, lo = 0, hi = len(values) - 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a real bug I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this would fail if There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. if There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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.
OTOH, the index constructor refuses to create empty indexes, so an end-to-end test does not seem possible. and Hmm. will have to think about this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In [18]: %%cython
...:
...: cdef int foo() except -1:
...: 1/0
...: cdef:
...: int mid = 42
...: return mid
...:
...: cdef int bar():
...: res = foo()
...: return res
...:
...: def baz():
...: return bar()
In [19]: baz()
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
_cython_magic_a591cd36cd8e49116d6e370949ee24c2.pyx in _cython_magic_a591cd36cd8e49116d6e370949ee24c2.foo()
ZeroDivisionError: float division
Exception ignored in: '_cython_magic_a591cd36cd8e49116d6e370949ee24c2.bar'
Traceback (most recent call last):
File "_cython_magic_a591cd36cd8e49116d6e370949ee24c2.pyx", line 3, in _cython_magic_a591cd36cd8e49116d6e370949ee24c2.foo
ZeroDivisionError: float division
Out[19]: 0 very interesting bug. |
||
object pval | ||
|
||
if hi >= 0 and val > util.get_value_at(values, hi): | ||
if hi == 0 or (hi > 0 and val > util.get_value_at(values, hi)): | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
return len(values) | ||
|
||
while lo < hi: | ||
|
Uh oh!
There was an error while loading. Please reload this page.