-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
post_execute
and post_run_cell
hooks not always triggered
#10774
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
Comments
Thanks for the report, you are right that we should split the post_execution hooks into hooks that execute after every requests, or only after every valid Python request. I don't think we should fix the current ones, but provide variants that also trigger even when the pre-execute fails. |
Hey @Carreau -- I'm curious about the details of what you're proposing.
Thinking it through, I could see an argument that the right answer here is to say "we will be explicit about documenting and sticking to the current behavior, because it's a subtle behavior change. If you want something else, you should override |
Probably not that granular.
Yes.
I see you are 0-indexed. And so we have at least 1 more data point: I would have expected these hooks to not trigger on failure :-)
Yes, probably a We'll better document anyway ! Thanks ! |
Also, provide the execution result object as an argument for both *pre* and *post* event callbacks in a backward compatible manner. Closes ipython#10774.
Due to various early returns in the code below,
post_execute
andpost_run_cell
hooks are not triggered in some cases. Since the pre hooks are always called, this is either a bug or the docs should mention that post hooks are not guaranteed to be triggered.ipython/IPython/core/interactiveshell.py
Lines 2694 to 2739 in ca86b79
/cc @craigcitro
The text was updated successfully, but these errors were encountered: