You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Document how the msg parameter for asyncio.futures.Future.cancel is used #148091
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.
Activity
jonathandung commentedon Apr 8, 2026
Sure.
gh-148091: clarify asyncio.Future.cancel(msg) behaviour (#148248)
pythongh-148091: clarify asyncio.Future.cancel(msg) behaviour (python…
pythongh-148091: clarify asyncio.Future.cancel(msg) behaviour (python…
[3.13] gh-148091: clarify asyncio.Future.cancel(msg) behaviour (GH-14…
[3.14] gh-148091: clarify asyncio.Future.cancel(msg) behaviour (GH-14…
pythongh-148091: clarify asyncio.Future.cancel(msg) behaviour (python…