diff options
author | Xtreak <tir.karthi@gmail.com> | 2019-09-11 14:12:51 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-09-11 14:12:51 (GMT) |
commit | 7b69069e9aa0047a0dbe8af1a67aa2b355dc68d8 (patch) | |
tree | 5cf1d09fba95aed628b4b477bacd6e5bed74226a | |
parent | 97b817eae34b77be1ced382e15098a112f547848 (diff) | |
download | cpython-7b69069e9aa0047a0dbe8af1a67aa2b355dc68d8.zip cpython-7b69069e9aa0047a0dbe8af1a67aa2b355dc68d8.tar.gz cpython-7b69069e9aa0047a0dbe8af1a67aa2b355dc68d8.tar.bz2 |
bpo-37651: Document CancelledError is now a subclass of BaseException (GH-15950)
https://bugs.python.org/issue37651
Automerge-Triggered-By: @1st1
-rw-r--r-- | Doc/library/asyncio-exceptions.rst | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/Doc/library/asyncio-exceptions.rst b/Doc/library/asyncio-exceptions.rst index e49577a..b1e6ecf 100644 --- a/Doc/library/asyncio-exceptions.rst +++ b/Doc/library/asyncio-exceptions.rst @@ -25,26 +25,9 @@ Exceptions when asyncio Tasks are cancelled. In almost all situations the exception must be re-raised. - .. important:: - - This exception is a subclass of :exc:`Exception`, so it can be - accidentally suppressed by an overly broad ``try..except`` block:: - - try: - await operation - except Exception: - # The cancellation is broken because the *except* block - # suppresses the CancelledError exception. - log.log('an error has occurred') - - Instead, the following pattern should be used:: + .. versionchanged:: 3.8 - try: - await operation - except asyncio.CancelledError: - raise - except Exception: - log.log('an error has occurred') + :exc:`CancelledError` is now a subclass of :class:`BaseException`. .. exception:: InvalidStateError |