diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-01 12:27:09 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-02-01 13:12:57 -0500 |
commit | c797056413230cc5c11bc458e5f7760063c2682e (patch) | |
tree | 58a7cebda24e574aafe4a04b1258680248ed59fd /lib/sqlalchemy/pool | |
parent | 2df647cd7590ae31b542256a5036d2ff49f321aa (diff) | |
download | sqlalchemy-c797056413230cc5c11bc458e5f7760063c2682e.tar.gz |
Do away with pool._refs
This collection was added only for the benefit of unit tests
and is unnecessary for the pool to function. As SQLAlchemy 2.0
will be removing the automatic handling of connections that are
garbage collection, remove this collection so that we ultimately
don't need a weakref handler to do anything within the pool.
The handler will do nothing other than emit a warning that
a connection was dereferenced without being explicitly returned
to the pool, invalidated, or detached.
Change-Id: I4ca196270d5714efbac44dbf6f034e8c7f0af58a
Diffstat (limited to 'lib/sqlalchemy/pool')
-rw-r--r-- | lib/sqlalchemy/pool/__init__.py | 1 | ||||
-rw-r--r-- | lib/sqlalchemy/pool/base.py | 6 |
2 files changed, 0 insertions, 7 deletions
diff --git a/lib/sqlalchemy/pool/__init__.py b/lib/sqlalchemy/pool/__init__.py index 058d595c8..eb0d37517 100644 --- a/lib/sqlalchemy/pool/__init__.py +++ b/lib/sqlalchemy/pool/__init__.py @@ -21,7 +21,6 @@ from . import events # noqa from .base import _ConnectionFairy # noqa from .base import _ConnectionRecord # noqa from .base import _finalize_fairy # noqa -from .base import _refs # noqa from .base import Pool from .base import reset_commit from .base import reset_none diff --git a/lib/sqlalchemy/pool/base.py b/lib/sqlalchemy/pool/base.py index 508d03630..bdb981699 100644 --- a/lib/sqlalchemy/pool/base.py +++ b/lib/sqlalchemy/pool/base.py @@ -425,7 +425,6 @@ class _ConnectionRecord(object): lambda ref: _finalize_fairy and _finalize_fairy(None, rec, pool, ref, echo), ) - _refs.add(rec) if echo: pool.logger.debug( "Connection %r checked out from pool", dbapi_connection @@ -594,7 +593,6 @@ def _finalize_fairy( been garbage collected. """ - _refs.discard(connection_record) if ref is not None: if connection_record.fairy_ref is not ref: @@ -633,9 +631,6 @@ def _finalize_fairy( connection_record.checkin() -_refs = set() - - class _ConnectionFairy(object): """Proxies a DBAPI connection and provides return-on-dereference @@ -918,7 +913,6 @@ class _ConnectionFairy(object): if self._connection_record is not None: rec = self._connection_record - _refs.remove(rec) rec.fairy_ref = None rec.connection = None # TODO: should this be _return_conn? |