bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979)
diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst
index 832d581..e1ac18e 100644
--- a/Doc/library/asyncio-future.rst
+++ b/Doc/library/asyncio-future.rst
@@ -170,7 +170,7 @@
Returns the number of callbacks removed, which is typically 1,
unless a callback was added more than once.
- .. method:: cancel()
+ .. method:: cancel(msg=None)
Cancel the Future and schedule callbacks.
@@ -178,6 +178,9 @@
Otherwise, change the Future's state to *cancelled*,
schedule the callbacks, and return ``True``.
+ .. versionchanged:: 3.9
+ Added the ``msg`` parameter.
+
.. method:: exception()
Return the exception that was set on this Future.
@@ -255,3 +258,6 @@
- asyncio Future is not compatible with the
:func:`concurrent.futures.wait` and
:func:`concurrent.futures.as_completed` functions.
+
+ - :meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument,
+ but :func:`concurrent.futures.cancel` does not.
diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst
index bc8a272..2e96339 100644
--- a/Doc/library/asyncio-task.rst
+++ b/Doc/library/asyncio-task.rst
@@ -724,7 +724,7 @@
.. deprecated-removed:: 3.8 3.10
The *loop* parameter.
- .. method:: cancel()
+ .. method:: cancel(msg=None)
Request the Task to be cancelled.
@@ -739,6 +739,9 @@
suppressing cancellation completely is not common and is actively
discouraged.
+ .. versionchanged:: 3.9
+ Added the ``msg`` parameter.
+
.. _asyncio_example_task_cancel:
The following example illustrates how coroutines can intercept