diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/loader.py | 2 | ||||
| -rw-r--r-- | django/db/utils.py | 2 | ||||
| -rw-r--r-- | django/utils/timezone.py | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py index 310a4d01b4..7ef5e9d4d6 100644 --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -272,6 +272,8 @@ class MigrationLoader(object): ), missing) exc_value.__cause__ = exc + if not hasattr(exc, '__traceback__'): + exc.__traceback__ = sys.exc_info()[2] six.reraise(NodeNotFoundError, exc_value, sys.exc_info()[2]) raise exc diff --git a/django/db/utils.py b/django/db/utils.py index aaa992c040..92354b7bad 100644 --- a/django/db/utils.py +++ b/django/db/utils.py @@ -85,6 +85,8 @@ class DatabaseErrorWrapper(object): if issubclass(exc_type, db_exc_type): dj_exc_value = dj_exc_type(*exc_value.args) dj_exc_value.__cause__ = exc_value + if not hasattr(exc_value, '__traceback__'): + exc_value.__traceback__ = traceback # Only set the 'errors_occurred' flag for errors that may make # the connection unusable. if dj_exc_type not in (DataError, IntegrityError): diff --git a/django/utils/timezone.py b/django/utils/timezone.py index 70fd5e3e48..205cac44a9 100644 --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -146,6 +146,8 @@ class LocalTimezone(ReferenceLocalTimezone): exc_value = exc_type( "Unsupported value: %r. You should install pytz." % dt) exc_value.__cause__ = exc + if not hasattr(exc, '__traceback__'): + exc.__traceback__ = sys.exc_info()[2] six.reraise(exc_type, exc_value, sys.exc_info()[2]) utc = pytz.utc if pytz else UTC() |
