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

This commit is contained in:
Yury Selivanov 2017-06-11 13:49:18 +00:00 committed by GitHub
parent 36ff451eba
commit 7ce1c6fb57
6 changed files with 49 additions and 1 deletions

View file

@ -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

View file

@ -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: