]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Handle BaseException in all _handle_dbapi_error
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 21 Sep 2016 19:37:20 +0000 (15:37 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 21 Sep 2016 22:39:31 +0000 (18:39 -0400)
commit7827dfb6726a682c630d66b24423582d5dc09589
tree924c2abdb48154bbc36f09c9c4575a69873414e4
parent930b07c3af5300e65473d44535db8c1d7133cb13
Handle BaseException in all _handle_dbapi_error

Tests illustrate that exceptions like GreenletExit and
even KeyboardInterrupt can corrupt the state of a DBAPI
connection like that of pymysql and mysqlclient.   Intercept
BaseException errors within the handle_error scheme and
invalidate just the connection alone in this case, but not
the whole pool.

The change is backwards-incompatible with a program that
currently intercepts ctrl-C within a database transaction
and wants to continue working on that transaction.  Ensure
the event hook can be used to reverse this behavior.

Change-Id: Ifaa013c13826d123eef34e32b7e79fff74f1b21b
Fixes: #3803
doc/build/changelog/changelog_11.rst
doc/build/changelog/migration_11.rst
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/events.py
lib/sqlalchemy/pool.py
test/engine/test_reconnect.py