Skip to content

Commit 65d0cbe

Browse files
committed
PYTHON-5672 Fix MockPool.checkout() bypass in _ClientCheckout
Constructing _PoolCheckout directly bypassed pool.checkout() overrides used in MockPool, causing mock_down_hosts checks to be skipped and network-error tests to fail.
1 parent 9e5dcb2 commit 65d0cbe

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

pymongo/asynchronous/mongo_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2716,7 +2716,7 @@ async def __aenter__(self) -> AsyncConnection:
27162716
if in_txn and session and session._pinned_connection:
27172717
self.contribute_socket(session._pinned_connection)
27182718
return session._pinned_connection
2719-
pool_checkout = _PoolCheckout(server.pool, self)
2719+
pool_checkout = server.pool.checkout(self)
27202720
try:
27212721
conn = await pool_checkout.__aenter__()
27222722
except BaseException as exc:

pymongo/synchronous/mongo_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2705,7 +2705,7 @@ def __enter__(self) -> Connection:
27052705
if in_txn and session and session._pinned_connection:
27062706
self.contribute_socket(session._pinned_connection)
27072707
return session._pinned_connection
2708-
pool_checkout = _PoolCheckout(server.pool, self)
2708+
pool_checkout = server.pool.checkout(self)
27092709
try:
27102710
conn = pool_checkout.__enter__()
27112711
except BaseException as exc:

0 commit comments

Comments
 (0)