bpo-30508: Don't log exceptions if Task/Future "cancel()" method was called. (#2109)

This commit is contained in:
Yury Selivanov 2017-06-11 14:00:14 +00:00 committed by GitHub
parent 59422a29ee
commit 176f2ebdad
6 changed files with 49 additions and 1 deletions

View file

@ -191,6 +191,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

View file

@ -148,6 +148,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: