mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-30508: Don't log exceptions if Task/Future "cancel()" method called (#2050)
This commit is contained in:
parent
36ff451eba
commit
7ce1c6fb57
6 changed files with 49 additions and 1 deletions
|
@ -107,6 +107,7 @@ class Future:
|
|||
change the future's state to cancelled, schedule the callbacks and
|
||||
return True.
|
||||
"""
|
||||
self._log_traceback = False
|
||||
if self._state != _PENDING:
|
||||
return False
|
||||
self._state = _CANCELLED
|
||||
|
|
|
@ -144,6 +144,7 @@ class Task(futures.Future):
|
|||
terminates with a CancelledError exception (even if cancel()
|
||||
was not called).
|
||||
"""
|
||||
self._log_traceback = False
|
||||
if self.done():
|
||||
return False
|
||||
if self._fut_waiter is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue