diff options
| author | François Freitag <mail@franek.fr> | 2017-04-18 11:15:42 -0700 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-04-20 17:43:39 +0200 |
| commit | 56746fb21f6bbf93fe96f4e3908040111439c9c3 (patch) | |
| tree | 9bc008d23c692b1d86939bc1517774301f0de707 /django | |
| parent | 5e2bbcd70c9b0213bfda31b90e4b1c35815880e9 (diff) | |
[1.11.x] Fixed #28091 -- Re-raised original exception when closing cursor cleanup fails
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/sql/compiler.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py index 1c6fad4d76..9acb56aa84 100644 --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -874,7 +874,7 @@ class SQLCompiler(object): cursor = self.connection.cursor() try: cursor.execute(sql, params) - except Exception: + except Exception as original_exception: try: # Might fail for server-side cursors (e.g. connection closed) cursor.close() @@ -883,7 +883,7 @@ class SQLCompiler(object): # Python 2 doesn't chain exceptions. Remove this error # silencing when dropping Python 2 compatibility. pass - raise + raise original_exception if result_type == CURSOR: # Caller didn't specify a result_type, so just give them back the |
