google / google/duet

Should CancelledError derive from BaseException?

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
27
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Currently when a task is cancelled we use `concurrent.futures.CancelledError`, which derives from `Exception`, rather than `BaseException`. The problem with this is that code that catches `Exception` will also capture `CancelledError` and may thus inadvertently swallow the cancellation. We might want to use an exception type that derives from `BaseException` instead, so that it will propagate by default unless the user does something to explicitly catch it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.