[Python-checkins] cpython (merge 3.5 -> default): asyncio: Drop some useless code from tasks.py.

yury.selivanov python-checkins at python.org
Thu May 28 16:53:23 CEST 2015


https://hg.python.org/cpython/rev/9c0a00247021
changeset:   96331:9c0a00247021
parent:      96328:dfe62f685538
parent:      96330:adf72cffceb7
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Thu May 28 10:53:04 2015 -0400
summary:
  asyncio: Drop some useless code from tasks.py.

See also issue 24017.

files:
  Lib/asyncio/tasks.py |  9 ++-------
  1 files changed, 2 insertions(+), 7 deletions(-)


diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -74,10 +74,7 @@
         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 @@
         try:
             if exc is not None:
                 result = coro.throw(exc)
-            elif value is not None:
+            else:
                 result = coro.send(value)
-            else:
-                result = coro.send(None)
         except StopIteration as exc:
             self.set_result(exc.value)
         except futures.CancelledError as exc:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list