diff options
-rw-r--r-- | trollius/futures.py | 2 | ||||
-rw-r--r-- | trollius/tasks.py | 6 |
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: |