-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Document how the msg parameter for asyncio.futures.Future.cancel is used #148091
Copy link
Copy link
Open
Labels
Description
Documentation
Currently, in the user-facing asyncio docs for Futures, it is mentioned that the signature of cancel changed to cancel(msg=None) in python 3.9.
However, the msg parameter has never been explained:
.. method:: cancel(msg=None)
Cancel the Future and schedule callbacks.
If the Future is already *done* or *cancelled*, return ``False``.
Otherwise, change the Future's state to *cancelled*,
schedule the callbacks, and return ``True``.
.. versionchanged:: 3.9
Added the *msg* parameter.From its name, users may incorrectly assume it stands for 'message' and thus must be a string, whereas to my understanding, it is but the argument passed to the instance of asyncio.exceptions.CancelledError thrown to waiters of the future, and can be of any type.
See the .rst source of the relevant documentation segment and the asyncio source.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Projects
Status
Todo
Status
Todo