diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-28 14:53:04 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-28 14:53:04 (GMT) |
commit | ee941b0278d6ea69d01f84e2c69cb8024e8a01bd (patch) | |
tree | 98a451b56cd928003a54a23e1816cfab1218ff2f | |
parent | ffb40e5ec376aa755e92edb00c7db361f3007b6c (diff) | |
parent | 6076a385e3f37ba15489989549c96f231e60056b (diff) | |
download | cpython-ee941b0278d6ea69d01f84e2c69cb8024e8a01bd.zip cpython-ee941b0278d6ea69d01f84e2c69cb8024e8a01bd.tar.gz cpython-ee941b0278d6ea69d01f84e2c69cb8024e8a01bd.tar.bz2 |
asyncio: Drop some useless code from tasks.py.
See also issue 24017.
-rw-r--r-- | Lib/asyncio/tasks.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py index fcb3833..d8193ba 100644 --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -74,10 +74,7 @@ class Task(futures.Future): super().__init__(loop=loop) if self._source_traceback: del self._source_traceback[-1] - if coro.__class__ is types.GeneratorType: - self._coro = coro - else: - self._coro = iter(coro) # Use the iterator just in case. + self._coro = coro self._fut_waiter = None self._must_cancel = False self._loop.call_soon(self._step) @@ -237,10 +234,8 @@ class Task(futures.Future): try: if exc is not None: result = coro.throw(exc) - elif value is not None: - result = coro.send(value) else: - result = coro.send(None) + result = coro.send(value) except StopIteration as exc: self.set_result(exc.value) except futures.CancelledError as exc: |