summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhawal Yogesh Bhanushali <dbhanushali@vmware.com>2015-11-12 18:37:25 -0800
committerDhawal Yogesh Bhanushali <dbhanushali@vmware.com>2015-11-12 18:37:25 -0800
commitf285592a7193e2e2a96af344efffb6dc8ad9836a (patch)
treeca592e1385e0d3662350f8348f0e2753f7c11f7e
parent0727ad2b6d49cd94ea0fb86ef08c8050208b839a (diff)
downloadtrollius-git-f285592a7193e2e2a96af344efffb6dc8ad9836a.tar.gz
better exception traceback
-rw-r--r--trollius/futures.py2
-rw-r--r--trollius/tasks.py6
2 files changed, 6 insertions, 2 deletions
diff --git a/trollius/futures.py b/trollius/futures.py
index 4d4e20f..746124b 100644
--- a/trollius/futures.py
+++ b/trollius/futures.py
@@ -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()
diff --git a/trollius/tasks.py b/trollius/tasks.py
index 3e0e1b1..af5c868 100644
--- a/trollius/tasks.py
+++ b/trollius/tasks.py
@@ -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: