Skip to content

Commit

Permalink
Fixed #7241 -- More robust exception catching in the transaction mana…
Browse files Browse the repository at this point in the history
…gement

code. As pointed out in the ticket, Python still lets you raise all sorts of
odd things as exceptions (e.g. strings), so even though they're bad form, we
should still handle them. We do that cleanly now. Thanks to jim-django@dsdd.org
for the patch.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8419 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Aug 17, 2008
1 parent 2d2396a commit 2605104
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions django/db/transaction.py
Expand Up @@ -236,10 +236,8 @@ def _commit_on_success(*args, **kw):
managed(True) managed(True)
try: try:
res = func(*args, **kw) res = func(*args, **kw)
except (Exception, KeyboardInterrupt, SystemExit): except:
# (We handle KeyboardInterrupt and SystemExit specially, since # All exceptions must be handled here (even string ones).
# they don't inherit from Exception in Python 2.5, but we
# should treat them uniformly here.)
if is_dirty(): if is_dirty():
rollback() rollback()
raise raise
Expand Down

0 comments on commit 2605104

Please sign in to comment.