File tree Expand file tree Collapse file tree 1 file changed +2
-19
lines changed
Expand file tree Collapse file tree 1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -25,26 +25,9 @@ Exceptions
2525 when asyncio Tasks are cancelled. In almost all situations the
2626 exception must be re-raised.
2727
28- .. important ::
29-
30- This exception is a subclass of :exc: `Exception `, so it can be
31- accidentally suppressed by an overly broad ``try..except `` block::
32-
33- try:
34- await operation
35- except Exception:
36- # The cancellation is broken because the *except* block
37- # suppresses the CancelledError exception.
38- log.log('an error has occurred')
39-
40- Instead, the following pattern should be used::
28+ .. versionchanged :: 3.8
4129
42- try:
43- await operation
44- except asyncio.CancelledError:
45- raise
46- except Exception:
47- log.log('an error has occurred')
30+ :exc: `CancelledError ` is now a subclass of :class: `BaseException `.
4831
4932
5033.. exception :: InvalidStateError
You can’t perform that action at this time.
0 commit comments