diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-02 16:47:28 -0400 |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-02 16:47:41 -0400 |
commit | 51a3206600ff4c18f5368d0389157f6720126a4e (patch) | |
tree | 09fddebb4d6658e3926a3ee595a2d94df28933c2 | |
parent | 4851618b6b154272e79bdc1b5f63b4887e12d8e9 (diff) | |
download | trollius-git-51a3206600ff4c18f5368d0389157f6720126a4e.tar.gz |
Revert "tasks: Fix code style"
This reverts commit 4851618b6b154272e79bdc1b5f63b4887e12d8e9
per Guido's comment:
I don't like the refactoring. The original way (two nested if's) was IMO
clearer about the side effect (of calling cancel()) that only happens if
the first condition is true. The refactored version sweeps the side
effect under the proverbial mat.
-rw-r--r-- | asyncio/tasks.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/asyncio/tasks.py b/asyncio/tasks.py index 45c6d1b..9bfc1cf 100644 --- a/asyncio/tasks.py +++ b/asyncio/tasks.py @@ -249,8 +249,9 @@ class Task(futures.Future): result._blocking = False result.add_done_callback(self._wakeup) self._fut_waiter = result - if self._must_cancel and self._fut_waiter.cancel(): - self._must_cancel = False + if self._must_cancel: + if self._fut_waiter.cancel(): + self._must_cancel = False else: self._loop.call_soon( self._step, None, |