bpo-46829: Deprecate passing a message into Future.cancel() and Task.cancel() (GH-31840)
After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
This commit is contained in:
@@ -207,6 +207,11 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
|
||||
|
||||
This also increases the task's count of cancellation requests.
|
||||
"""
|
||||
if msg is not None:
|
||||
warnings.warn("Passing 'msg' argument to Task.cancel() "
|
||||
"is deprecated since Python 3.11, and "
|
||||
"scheduled for removal in Python 3.14.",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
self._log_traceback = False
|
||||
if self.done():
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user