-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: avoid catching all exceptions in libreduction #38285
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 1 commit
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 |
---|---|---|
|
@@ -198,13 +198,10 @@ def apply(self, f: F, data: FrameOrSeries, axis: int = 0): | |
try: | ||
result_values, mutated = splitter.fast_apply(f, sdata, group_keys) | ||
|
||
except libreduction.InvalidApply as err: | ||
# This Exception is raised if `f` triggers an exception | ||
# but it is preferable to raise the exception in Python. | ||
if "Let this error raise above us" not in str(err): | ||
# TODO: can we infer anything about whether this is | ||
# worth-retrying in pure-python? | ||
raise | ||
except IndexError: | ||
# test_apply_mutate this is a rare case in which re-running | ||
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. which test is this referring to? (I don't see a 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. test_apply_mutate.py, will update to make clearer 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. @jbrockmendel is there something you were going to update here? 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. thanks for the reminder, just updated |
||
# in python-space may make a difference | ||
pass | ||
|
||
else: | ||
# If the fast apply path could be used we can return here. | ||
|
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.
Is this fixing a specific bug? (but don't see any test added)
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.
without this we have other tests that fail in cython but not in python, but im not aware of any bugs this causes in master
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.
You mean that on master the
try: piece = f(chunk) ...
would fail, and thus be elevated to the python level (where it worked), but with this fix ensures those specific cases don't fail anymore an work on the cython level?Can you give an example of such a test?
Also, the issues number in the comment seems not directly related (well, it might be it was needed there as well, but since that's an open PR, that's a bit confusing reference)
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.
Will attempt to clarify .