diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-03-27 10:52:58 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-03-27 11:15:41 -0400 |
| commit | 08f42a915a40756dc9222077ea41cdd32c079b4b (patch) | |
| tree | 317b78caa55a3fded650c978265ca3a3c5b5beb1 /lib/sqlalchemy/engine | |
| parent | 7a6cc6e897d85d7acb7a3eddf92620d6f330e8ce (diff) | |
| download | sqlalchemy-08f42a915a40756dc9222077ea41cdd32c079b4b.tar.gz | |
Add safe_reraise() + warnings only to Connection._autorollback
Added an exception handler that will warn for the "cause" exception on
Py2K when the "autorollback" feature of :class:`.Connection` itself
raises an exception. In Py3K, the two exceptions are naturally reported
by the interpreter as one occurring during the handling of the other.
This is continuing with the series of changes for rollback failure
handling that were last visited as part of :ticket:`2696` in 1.0.12.
Change-Id: I600ba455a14ebaea27c6189889181f97c632f179
Fixes: #3946
(cherry picked from commit c0a224aba3d4e2a41f92a29f9d18c6cb9d09d61f)
Diffstat (limited to 'lib/sqlalchemy/engine')
| -rw-r--r-- | lib/sqlalchemy/engine/base.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 0334d2d7a..f680edada 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -1383,7 +1383,8 @@ class Connection(Connectable): if not self._is_disconnect: if cursor: self._safe_close_cursor(cursor) - self._autorollback() + with util.safe_reraise(warn_only=True): + self._autorollback() if newraise: util.raise_from_cause(newraise, exc_info) |
