diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-07 11:28:49 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-07 12:44:58 -0400 |
commit | 2fa39312b2c878b717d4c4f41380e5a8931eb374 (patch) | |
tree | b9b33cf021e82227bd6ab237a06922e0388769be /lib/sqlalchemy/util/concurrency.py | |
parent | 94169108cdd4dace09b752a6af4f4404819b49a3 (diff) | |
download | sqlalchemy-2fa39312b2c878b717d4c4f41380e5a8931eb374.tar.gz |
Add asyncio.TimeoutError as an exit exception
Added ``asyncio.exceptions.TimeoutError``,
``asyncio.exceptions.CancelledError`` as so-called "exit exceptions", a
class of exceptions that include things like ``GreenletExit`` and
``KeyboardInterrupt``, which are considered to be events that warrant
considering a DBAPI connection to be in an unusable state where it should
be recycled.
Fixes: #6592
Change-Id: Idcfa7aaa2d7660838b907388db9c6457afa6edbd
Diffstat (limited to 'lib/sqlalchemy/util/concurrency.py')
-rw-r--r-- | lib/sqlalchemy/util/concurrency.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util/concurrency.py b/lib/sqlalchemy/util/concurrency.py index 60db9cfff..463547319 100644 --- a/lib/sqlalchemy/util/concurrency.py +++ b/lib/sqlalchemy/util/concurrency.py @@ -12,6 +12,7 @@ if compat.py3k: from ._concurrency_py3k import await_only from ._concurrency_py3k import await_fallback from ._concurrency_py3k import greenlet_spawn + from ._concurrency_py3k import is_exit_exception from ._concurrency_py3k import AsyncAdaptedLock from ._concurrency_py3k import _util_async_run # noqa F401 from ._concurrency_py3k import ( @@ -36,6 +37,9 @@ if not have_greenlet: "the greenlet library is required to use this function." ) + def is_exit_exception(e): # noqa F811 + return not isinstance(e, Exception) + def await_only(thing): # noqa F811 _not_implemented() |