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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user