6262 _CertificateError ,
6363)
6464from pymongo .hello import Hello , HelloCompat
65- from pymongo .lock import _create_lock
65+ from pymongo .lock import _create_lock , _Lock
6666from pymongo .logger import (
6767 _CONNECTION_LOGGER ,
6868 _ConnectionStatusMessage ,
@@ -988,7 +988,8 @@ def __init__(
988988 # from the right side.
989989 self .conns : collections .deque = collections .deque ()
990990 self .active_contexts : set [_CancellationContext ] = set ()
991- self .lock = _create_lock ()
991+ _lock = _create_lock ()
992+ self .lock = _Lock (_lock )
992993 self .active_sockets = 0
993994 # Monotonically increasing connection ID required for CMAP Events.
994995 self .next_connection_id = 1
@@ -1014,15 +1015,15 @@ def __init__(
10141015 # The first portion of the wait queue.
10151016 # Enforces: maxPoolSize
10161017 # Also used for: clearing the wait queue
1017- self .size_cond = threading .Condition (self . lock ) # type: ignore[arg-type]
1018+ self .size_cond = threading .Condition (_lock )
10181019 self .requests = 0
10191020 self .max_pool_size = self .opts .max_pool_size
10201021 if not self .max_pool_size :
10211022 self .max_pool_size = float ("inf" )
10221023 # The second portion of the wait queue.
10231024 # Enforces: maxConnecting
10241025 # Also used for: clearing the wait queue
1025- self ._max_connecting_cond = threading .Condition (self . lock ) # type: ignore[arg-type]
1026+ self ._max_connecting_cond = threading .Condition (_lock )
10261027 self ._max_connecting = self .opts .max_connecting
10271028 self ._pending = 0
10281029 self ._client_id = client_id
0 commit comments