Opened 17 years ago
Closed 14 years ago
#6096 closed (fixed)
commit_on_success does not handle SystemExit
Reported by: | Owned by: | Fabián Ezequiel Gallina | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I do not know if commit_on_success intentionally only catches Exception instead of BaseException (or just a plain except:). I was writing a command-line script that called sys.exit(1) when it detected a problem, but the transaction manager was raising TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK") and it took me a long time to figure out what was going on.
If you don't want to change it to catch all exceptions, may I suggest adding a small note to the docs?
Change History (4)
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 14 years ago
Triage Stage: | Design decision needed → Accepted |
---|
Change this (you can use a bare "except" and just document it). I think this is just a consequence of us old-timers not always remembering SystemEerror
got moved outside of Exception in the hierarchy at some point in the last decade. We have more things to remember than you young guys, so be nice to us. :-)
comment:3 by , 14 years ago
Owner: | changed from | to
---|
comment:4 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This seems to be fixed already in the current trunk: http://code.djangoproject.com/browser/django/trunk/django/db/transaction.py?rev=14343#L336
Yea, sounds like a bug... passing to core to check.