This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author socketpair
Recipients asvetlov, socketpair, yselivanov
Date 2018-01-10.16:31:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I have discoverd one very ugly pattern connected with asyncio. Many times I see code like this:

    await something()
except Exception:
    log.error('Opertaion failed -- will retry later.')

Seems, everything is fine, but asyncio.CancelledError unintentionally
also suppressed in that code. So, sometimes coroutines are not cancellable.

In order to mitigate thi, we had to write:

    await something()
except CancelledError:
except Exception:
    log.error('Opertaion failed. will retry later.')

So, what I propose: Basically is to change base class for asyncio.CancelledError
from Exception (yes, I know concurrent.futures and it's `Error` class) to BaseException.

Just like `SystemExit` and other SPECIAL exceptions.

Yes, I know that it would be incompatible change. But I suspect that impact will be minimal. Documentation for concurrent.futures and asyncio does not say that this exception is derived from Exception.
Date User Action Args
2018-01-10 16:31:15socketpairsetrecipients: + socketpair, asvetlov, yselivanov
2018-01-10 16:31:15socketpairsetmessageid: <>
2018-01-10 16:31:15socketpairlinkissue32528 messages
2018-01-10 16:31:14socketpaircreate