-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
The roll_quantile function now throws an exception instead of causing a segfault #15476
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
Changes from 4 commits
f736ca2
f39b122
8b1e020
4eea34a
e31e5be
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 |
---|---|---|
|
@@ -134,8 +134,8 @@ cdef class WindowIndexer: | |
bint is_variable | ||
|
||
def get_data(self): | ||
return (self.start, self.end, <int64_t>self.N, | ||
<int64_t>self.win, <int64_t>self.minp, | ||
return (self.start, self.end, <int64_t>self.N, | ||
<int64_t>self.win, <int64_t>self.minp, | ||
self.is_variable) | ||
|
||
|
||
|
@@ -1285,6 +1285,9 @@ def roll_quantile(ndarray[float64_t, cast=True] input, int64_t win, | |
ndarray[int64_t] start, end | ||
ndarray[double_t] output | ||
|
||
if quantile < 0.0 or quantile > 1.0: | ||
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.
Oh, never mind. 😊 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. Yes, it can, please see the PR |
||
raise ValueError("quantile value {0} not in [0, 1]".format(quantile)) | ||
|
||
# we use the Fixed/Variable Indexer here as the | ||
# actual skiplist ops outweigh any window computation costs | ||
start, end, N, win, minp, is_variable = get_window_indexer( | ||
|
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.
The second call needs it's own
with
block, otherwise the first call's risenValueError
might (in theory) mask the second one's, or vice versa.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.
Fixed :D