Merge pull request #5 from imkin/trollius

better exception traceback
This commit is contained in:
Victor Stinner
2015-11-13 09:07:22 +01:00
2 changed files with 6 additions and 2 deletions

View File

@@ -371,7 +371,7 @@ class Future(object):
if exc_tb is not None:
self._exception_tb = exc_tb
exc_tb = None
elif self._loop.get_debug() and not six.PY3:
elif not six.PY3:
self._exception_tb = sys.exc_info()[2]
self._state = _FINISHED
self._schedule_callbacks()

View File

@@ -235,6 +235,7 @@ class Task(futures.Future):
def _step(self, value=None, exc=None, exc_tb=None):
assert not self.done(), \
'_step(): already done: {0!r}, {1!r}, {2!r}'.format(self, value, exc)
if self._must_cancel:
if not isinstance(exc, futures.CancelledError):
exc = futures.CancelledError()
@@ -250,7 +251,10 @@ class Task(futures.Future):
# Call either coro.throw(exc) or coro.send(value).
try:
if exc is not None:
result = coro.throw(exc)
if exc_tb is not None:
result = coro.throw(exc, None, exc_tb)
else:
result = coro.throw(exc)
else:
result = coro.send(value)
except StopIteration as exc: