diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-11-13 09:07:22 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-11-13 09:07:22 +0100 |
commit | 5388ec1ac155206e7ad1484d59dd4d8341d71aca (patch) | |
tree | ca592e1385e0d3662350f8348f0e2753f7c11f7e | |
parent | 0727ad2b6d49cd94ea0fb86ef08c8050208b839a (diff) | |
parent | f285592a7193e2e2a96af344efffb6dc8ad9836a (diff) | |
download | trollius-git-5388ec1ac155206e7ad1484d59dd4d8341d71aca.tar.gz |
Merge pull request #5 from imkin/trollius
better exception traceback
-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: |