diff options
| author | Luca Ferroni <luca@befair.it> | 2015-04-19 15:30:01 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-05-29 11:29:32 -0400 |
| commit | 38eacbde62cd83ffaa64db7719c2c643f69551e0 (patch) | |
| tree | eca7f7f21591286280790b6c0da7a1d509066365 /django | |
| parent | 24718b7dccd64dfa118fe8136e7b175babec679b (diff) | |
Refs #23643 -- Fixed debug view regression on Python 2.
Thanks Tomáš Ehrlich for help with the patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/debug.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index ae1352106a..78ce764cf0 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -409,7 +409,7 @@ class ExceptionReporter(object): # sometimes in Python 3), take the traceback from self.tb (Python 2 # doesn't have a __traceback__ attribute on Exception) exc_value = exceptions.pop() - tb = self.tb if not exceptions else exc_value.__traceback__ + tb = self.tb if six.PY2 or not exceptions else exc_value.__traceback__ while tb is not None: # Support for __traceback_hide__ which is used by a few libraries @@ -444,7 +444,9 @@ class ExceptionReporter(object): # If the traceback for current exception is consumed, try the # other exception. - if not tb.tb_next and exceptions: + if six.PY2: + tb = tb.tb_next + elif not tb.tb_next and exceptions: exc_value = exceptions.pop() tb = exc_value.__traceback__ else: |
