mirror of https://github.com/python/cpython
asyncio: Drop some useless code from tasks.py.
See also issue 24017.
This commit is contained in:
parent
46c759d76d
commit
1ad08a5555
|
@ -74,10 +74,7 @@ class Task(futures.Future):
|
||||||
super().__init__(loop=loop)
|
super().__init__(loop=loop)
|
||||||
if self._source_traceback:
|
if self._source_traceback:
|
||||||
del self._source_traceback[-1]
|
del self._source_traceback[-1]
|
||||||
if coro.__class__ is types.GeneratorType:
|
self._coro = coro
|
||||||
self._coro = coro
|
|
||||||
else:
|
|
||||||
self._coro = iter(coro) # Use the iterator just in case.
|
|
||||||
self._fut_waiter = None
|
self._fut_waiter = None
|
||||||
self._must_cancel = False
|
self._must_cancel = False
|
||||||
self._loop.call_soon(self._step)
|
self._loop.call_soon(self._step)
|
||||||
|
@ -237,10 +234,8 @@ class Task(futures.Future):
|
||||||
try:
|
try:
|
||||||
if exc is not None:
|
if exc is not None:
|
||||||
result = coro.throw(exc)
|
result = coro.throw(exc)
|
||||||
elif value is not None:
|
|
||||||
result = coro.send(value)
|
|
||||||
else:
|
else:
|
||||||
result = coro.send(None)
|
result = coro.send(value)
|
||||||
except StopIteration as exc:
|
except StopIteration as exc:
|
||||||
self.set_result(exc.value)
|
self.set_result(exc.value)
|
||||||
except futures.CancelledError as exc:
|
except futures.CancelledError as exc:
|
||||||
|
|
Loading…
Reference in New Issue