mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979)
This commit is contained in:
parent
fe1176e882
commit
1ce5841eca
10 changed files with 355 additions and 70 deletions
|
@ -75,9 +75,9 @@ class _OverlappedFuture(futures.Future):
|
|||
self._loop.call_exception_handler(context)
|
||||
self._ov = None
|
||||
|
||||
def cancel(self):
|
||||
def cancel(self, msg=None):
|
||||
self._cancel_overlapped()
|
||||
return super().cancel()
|
||||
return super().cancel(msg=msg)
|
||||
|
||||
def set_exception(self, exception):
|
||||
super().set_exception(exception)
|
||||
|
@ -149,9 +149,9 @@ class _BaseWaitHandleFuture(futures.Future):
|
|||
|
||||
self._unregister_wait_cb(None)
|
||||
|
||||
def cancel(self):
|
||||
def cancel(self, msg=None):
|
||||
self._unregister_wait()
|
||||
return super().cancel()
|
||||
return super().cancel(msg=msg)
|
||||
|
||||
def set_exception(self, exception):
|
||||
self._unregister_wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue