]> granicus.if.org Git - python/commit
bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)
authorYury Selivanov <yury@magic.io>
Mon, 27 May 2019 12:45:12 +0000 (14:45 +0200)
committerGitHub <noreply@github.com>
Mon, 27 May 2019 12:45:12 +0000 (14:45 +0200)
commit431b540bf79f0982559b1b0e420b1b085f667bb7
tree2e7027339ce786cc90e04cba1b03c71ecf38dfda
parent16cefb0bc7b05c08caf08525398ff178c35dece4
bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)

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
16 files changed:
Lib/asyncio/base_events.py
Lib/asyncio/base_subprocess.py
Lib/asyncio/events.py
Lib/asyncio/exceptions.py
Lib/asyncio/proactor_events.py
Lib/asyncio/selector_events.py
Lib/asyncio/sslproto.py
Lib/asyncio/staggered.py
Lib/asyncio/tasks.py
Lib/asyncio/transports.py
Lib/asyncio/unix_events.py
Lib/asyncio/windows_events.py
Lib/test/test_asyncio/test_base_events.py
Lib/test/test_asyncio/test_tasks.py
Misc/NEWS.d/next/Library/2019-05-23-17-37-22.bpo-32528.sGnkcl.rst [new file with mode: 0644]
Modules/_asynciomodule.c