bpo-32528: Make asyncio.CancelledError a BaseException. by 1st1 · Pull Request #13528 · python/cpython

asvetlov

asvetlov

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.

@1st1

bdarnell added a commit to bdarnell/tornado that referenced this pull request

Jun 22, 2019

achimnol added a commit to achimnol/aiotools that referenced this pull request

Aug 28, 2019

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

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

hoffmang9 pushed a commit to Chia-Network/chia-blockchain that referenced this pull request

Jul 27, 2020

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