Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #7241 -- More robust exception catching in the transaction mana…

…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...
commit 260510453f25c0ab00254a9efdd7bea35ecdcee6 1 parent 2d2396a
Malcolm Tredinnick authored August 17, 2008

Showing 1 changed file with 2 additions and 4 deletions. Show diff stats Hide diff stats

  1. 6  django/db/transaction.py
6  django/db/transaction.py
@@ -236,10 +236,8 @@ def _commit_on_success(*args, **kw):
236 236
             managed(True)
237 237
             try:
238 238
                 res = func(*args, **kw)
239  
-            except (Exception, KeyboardInterrupt, SystemExit):
240  
-                # (We handle KeyboardInterrupt and SystemExit specially, since
241  
-                # they don't inherit from Exception in Python 2.5, but we
242  
-                # should treat them uniformly here.)
  239
+            except:
  240
+                # All exceptions must be handled here (even string ones).
243 241
                 if is_dirty():
244 242
                     rollback()
245 243
                 raise

0 notes on commit 2605104

Please sign in to comment.
Something went wrong with that request. Please try again.