Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.6.x] Increased robustness of 58161e4. Refs #22291.

Backport of ee837b9 from master
  • Loading branch information...
commit 80f6cbbadbd33574c8b949a8fbc77a5e94398e54 1 parent 1d3d2b9
Aymeric Augustin aaugustin authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 django/db/transaction.py
10 django/db/transaction.py
View
@@ -302,7 +302,13 @@ def __exit__(self, exc_type, exc_value, traceback):
try:
connection.savepoint_commit(sid)
except DatabaseError:
- connection.savepoint_rollback(sid)
+ try:
+ connection.savepoint_rollback(sid)
+ except Error:
+ # If rolling back to a savepoint fails, mark for
+ # rollback at a higher level and avoid shadowing
+ # the original exception.
+ connection.needs_rollback = True
raise
else:
# Commit transaction
@@ -328,7 +334,7 @@ def __exit__(self, exc_type, exc_value, traceback):
else:
try:
connection.savepoint_rollback(sid)
- except DatabaseError:
+ except Error:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing
# the original exception.
Please sign in to comment.
Something went wrong with that request. Please try again.