Skip to content

Use 'except Exception' instead of 'except BaseException' in _ensure_from_loop_full_unpacking_scheduled_wrapper #105

Description

@coderabbitai

Summary

In promising/promise.py, the _ensure_from_loop_full_unpacking_scheduled_wrapper method catches BaseException, which intercepts KeyboardInterrupt and SystemExit. This converts them into stored Promise failures instead of allowing shutdown signals to propagate normally.

Details

This callback runs on the event-loop thread. Catching BaseException will intercept KeyboardInterrupt and SystemExit, converting them into stored Promise failures instead of allowing shutdown to propagate. The handler should use except Exception to catch only application exceptions.

Suggested Fix

try:
    self._ensure_from_loop_full_unpacking_scheduled()
except Exception as exc:
    self._force_internal_error_finish_from_loop(exc)

References

Reported by @coderabbitai, requested by @teremterem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions