Skip to content

Commit 08ac4e7

Browse files
committed
Rename AsyncThreadLock to match test expectation
1 parent ae5cd8f commit 08ac4e7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

httpcore/_async/connection_pool.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .._backends.base import SOCKET_OPTION, AsyncNetworkBackend
1010
from .._exceptions import ConnectionNotAvailable, UnsupportedProtocol
1111
from .._models import Origin, Proxy, Request, Response
12-
from .._synchronization import AsyncEvent, AsyncShieldCancellation, AsyncThreadLock
12+
from .._synchronization import AsyncEvent, AsyncShieldCancellation, AsyncThreadRLock
1313
from .connection import AsyncHTTPConnection
1414
from .interfaces import AsyncConnectionInterface, AsyncRequestInterface
1515

@@ -123,7 +123,7 @@ def __init__(
123123
# We only mutate the state of the connection pool within an 'optional_thread_lock'
124124
# context. This holds a threading lock unless we're running in async mode,
125125
# in which case it is a no-op.
126-
self._optional_thread_lock = AsyncThreadLock()
126+
self._optional_thread_lock = AsyncThreadRLock()
127127

128128
def create_connection(self, origin: Origin) -> AsyncConnectionInterface:
129129
if self._proxy is not None:

httpcore/_synchronization.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,16 @@ async def __aexit__(
9090
self._anyio_lock.release()
9191

9292

93-
class AsyncThreadLock:
93+
class AsyncThreadRLock:
9494
"""
9595
This is a threading-only lock for no-I/O contexts.
96+
The lock type is a reentrant lock.
9697
9798
In the sync case `ThreadRLock` provides thread locking.
98-
In the async case `AsyncThreadLock` is a no-op.
99+
In the async case `AsyncThreadRLock` is a no-op.
99100
"""
100101

101-
def __enter__(self) -> AsyncThreadLock:
102+
def __enter__(self) -> AsyncThreadRLock:
102103
return self
103104

104105
def __exit__(
@@ -259,7 +260,7 @@ class ThreadRLock:
259260
The lock type is a reentrant lock.
260261
261262
In the sync case `ThreadRLock` provides thread locking.
262-
In the async case `AsyncThreadLock` is a no-op.
263+
In the async case `AsyncThreadRLock` is a no-op.
263264
"""
264265

265266
def __init__(self) -> None:

0 commit comments

Comments
 (0)