diff options
author | ndparker <ndparker@users.noreply.github.com> | 2014-10-02 22:00:31 +0200 |
---|---|---|
committer | ndparker <ndparker@users.noreply.github.com> | 2014-10-02 22:00:31 +0200 |
commit | 690532131d8ce8250c62f1d3e27405902df03e70 (patch) | |
tree | 69ef40646aa14519b539ae9d09a16229b7b3e20a /lib/sqlalchemy/pool.py | |
parent | ce52dd9e3b71f2074d7821fe62803d4e0eefe512 (diff) | |
download | sqlalchemy-pr/140.tar.gz |
cleanup exception handling - use new exception hierarchy (since python 2.5)pr/140
Diffstat (limited to 'lib/sqlalchemy/pool.py')
-rw-r--r-- | lib/sqlalchemy/pool.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 0c162e984..a174df784 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -248,9 +248,7 @@ class Pool(log.Identified): self.logger.debug("Closing connection %r", connection) try: self._dialect.do_close(connection) - except (SystemExit, KeyboardInterrupt): - raise - except: + except Exception: self.logger.error("Exception closing connection %r", connection, exc_info=True) @@ -569,12 +567,12 @@ def _finalize_fairy(connection, connection_record, # Immediately close detached instances if not connection_record: pool._close_connection(connection) - except Exception as e: + except BaseException as e: pool.logger.error( "Exception during reset or similar", exc_info=True) if connection_record: connection_record.invalidate(e=e) - if isinstance(e, (SystemExit, KeyboardInterrupt)): + if not isinstance(e, Exception): raise if connection_record: @@ -842,9 +840,7 @@ class SingletonThreadPool(Pool): for conn in self._all_conns: try: conn.close() - except (SystemExit, KeyboardInterrupt): - raise - except: + except Exception: # pysqlite won't even let you close a conn from a thread # that didn't create it pass |