1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #22291 -- Avoided shadowing deadlock exceptions on MySQL.

Thanks err for the report.
This commit is contained in:
Aymeric Augustin
2014-03-23 20:45:22 +01:00
parent a6fc18594e
commit 58161e4e93
2 changed files with 53 additions and 2 deletions

View File

@@ -231,7 +231,13 @@ class Atomic(object):
if sid is None:
connection.needs_rollback = True
else:
connection.savepoint_rollback(sid)
try:
connection.savepoint_rollback(sid)
except DatabaseError:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing
# the original exception.
connection.needs_rollback = True
else:
# Roll back transaction
connection.rollback()