summaryrefslogtreecommitdiff
path: root/django/dispatch
diff options
context:
space:
mode:
authorUnai Zalakain <unai@gisa-elkartea.org>2013-10-30 12:11:04 +0100
committerTim Graham <timograham@gmail.com>2014-05-16 18:41:40 -0400
commitebb0279f4a7a7155c44c09506bbe5b1f9acc83a2 (patch)
tree769622df7218ad608f9bb0d85e510b4fd02245e7 /django/dispatch
parent79e9da3d1ef8c4bdc20d53b668228abb219ac55b (diff)
downloaddjango-ebb0279f4a7a7155c44c09506bbe5b1f9acc83a2.tar.gz
Fixed #16245 -- Included traceback in send_robust()'s response
Exceptions from the (receiver, exception) tuples returned by ``send_robust()`` now have always their traceback attached as their ``__traceback__`` argument.
Diffstat (limited to 'django/dispatch')
-rw-r--r--django/dispatch/dispatcher.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/dispatch/dispatcher.py b/django/dispatch/dispatcher.py
index ba97077ce5..20048f5c55 100644
--- a/django/dispatch/dispatcher.py
+++ b/django/dispatch/dispatcher.py
@@ -220,7 +220,8 @@ class Signal(object):
If any receiver raises an error (specifically any subclass of
Exception), the error instance is returned as the result for that
- receiver.
+ receiver. The traceback is always attached to the error at
+ ``__traceback__``.
"""
responses = []
if not self.receivers or self.sender_receivers_cache.get(sender) is NO_RECEIVERS:
@@ -232,6 +233,8 @@ class Signal(object):
try:
response = receiver(signal=self, sender=sender, **named)
except Exception as err:
+ if not hasattr(err, '__traceback__'):
+ err.__traceback__ = sys.exc_info()[2]
responses.append((receiver, err))
else:
responses.append((receiver, response))