Skip to content
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

Python: don't catch KeyboardInterrupt and SystemExit #4333

Merged
merged 5 commits into from
Nov 27, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rerun_py/rerun_sdk/rerun/error_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def __exit__(
exc_tb: TracebackType | None,
) -> bool:
try:
if exc_type is not None and not strict_mode():
if exc_type is not None and exc_type is not KeyboardInterrupt and not strict_mode():
Copy link
Member

@emilk emilk Nov 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is the better fix - this will ignore both KeyboardInterrupt and SystemExit

Suggested change
if exc_type is not None and exc_type is not KeyboardInterrupt and not strict_mode():
if exc_type is Exception and not strict_mode():

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the intention, perhaps worth adding a comment to the effect as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilk well spotted (I had forgotten about that Exception vs. BaseException thing). I fixed the code with the correct issubclass check + a comment.

if getattr(_rerun_exception_ctx, "pending_warnings", None) is None:
_rerun_exception_ctx.pending_warnings = []

Expand Down
Loading