bpo-32528: Make asyncio.CancelledError a BaseException.#13528
Merged
1st1 merged 2 commits intopython:masterfrom May 27, 2019
Merged
bpo-32528: Make asyncio.CancelledError a BaseException.#135281st1 merged 2 commits intopython:masterfrom
1st1 merged 2 commits intopython:masterfrom
Conversation
Contributor
|
I see a small problem with the PR in The test passes but a message is printed: I suggest a little different implementation. By this, we keep exception handling logic in asyncio unchanged but put CacelledError at the proper place in exceptions hierarchy. |
asvetlov
approved these changes
May 24, 2019
This will address the common mistake many asyncio users make: an "except Exception" clause breaking Tasks cancellation. In addition to this change, we stop inheriting asyncio.TimeoutError and asyncio.InvalidStateError from their concurrent.futures.* counterparts. There's no point for these exceptions to share the inheritance chain.
bdarnell
added a commit
to bdarnell/tornado
that referenced
this pull request
Jun 22, 2019
python/cpython#13528 broke us in two ways: asyncio.CancelledError is no longer an alias for concurrent.futures.CancelledError and it's now a BaseException. Fixes tornadoweb#2677 Closes tornadoweb#2681
achimnol
added a commit
to achimnol/aiotools
that referenced
this pull request
Aug 28, 2019
* See also: https://bugs.python.org/issue32528 * This change makes actxmgr cancellation behaviors in Python 3.6/3.7/3.8 consistent.
DinoV
pushed a commit
to DinoV/cpython
that referenced
this pull request
Jan 14, 2020
This will address the common mistake many asyncio users make: an "except Exception" clause breaking Tasks cancellation. In addition to this change, we stop inheriting asyncio.TimeoutError and asyncio.InvalidStateError from their concurrent.futures.* counterparts. There's no point for these exceptions to share the inheritance chain. In 3.9 we'll focus on implementing supervisors and cancel scopes, which should allow better handling of all exceptions, including SystemExit and KeyboardInterrupt
miss-islington
pushed a commit
that referenced
this pull request
Jul 14, 2020
…or (GH-21474) #msg373510 [bpo-32528]()/#13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 14, 2020
…or (pythonGH-21474) GH-msg373510 [bpo-32528]()/pythonGH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1 (cherry picked from commit 2a51818) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
This was referenced Jul 14, 2020
Closed
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 14, 2020
…or (pythonGH-21474) GH-msg373510 [bpo-32528]()/pythonGH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1 (cherry picked from commit 2a51818) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
miss-islington
added a commit
that referenced
this pull request
Jul 19, 2020
…or (GH-21474) GH-msg373510 [bpo-32528]()/GH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1 (cherry picked from commit 2a51818) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jul 24, 2020
…or (pythonGH-21474) GH-msg373510 [bpo-32528]()/pythonGH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1 (cherry picked from commit 2a51818) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
miss-islington
added a commit
that referenced
this pull request
Jul 24, 2020
…or (GH-21474) GH-msg373510 [bpo-32528]()/GH-13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1 (cherry picked from commit 2a51818) Co-authored-by: JustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
hoffmang9
pushed a commit
to Chia-Network/chia-blockchain
that referenced
this pull request
Jul 27, 2020
* fix for 3.8 python pull 13528 - python/cpython#13528 * changes * flake8
hoffmang9
pushed a commit
to Chia-Network/chia-blockchain
that referenced
this pull request
Jul 27, 2020
* fix for 3.8 python pull 13528 - python/cpython#13528 * changes * flake8
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Aug 4, 2020
…or (pythonGH-21474) #msg373510 [bpo-32528]()/python#13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Aug 20, 2020
…or (pythonGH-21474) #msg373510 [bpo-32528]()/python#13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1
xzy3
pushed a commit
to xzy3/cpython
that referenced
this pull request
Oct 18, 2020
…or (pythonGH-21474) #msg373510 [bpo-32528]()/python#13528 changed `asyncio.CancelledError` such that it no longer inherits from `concurrent.futures.CancelledError`. As this affects existing code, specifically when catching the latter instead of the former in exception handling, it should be documented in the "What's new in 3.8?" document. Automerge-Triggered-By: @1st1
vxgmichel
referenced
this pull request
in vxgmichel/aioconsole
Jan 26, 2022
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This will address the common mistake many asyncio users make:
an "except Exception" clause breaking Tasks cancellation.
In addition to this change, we stop inheriting asyncio.TimeoutError
and asyncio.InvalidStateError from their concurrent.futures.*
counterparts. There's no point for these exceptions to share the
inheritance chain.
https://bugs.python.org/issue32528