Skip to content

Commit e7d8601

Browse files
Use AnyIO fast_acquire
1 parent 711292e commit e7d8601

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

httpcore/_synchronization.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def setup(self) -> None:
6464
if self._backend == "trio":
6565
self._trio_lock = trio.Lock()
6666
elif self._backend == "asyncio":
67-
self._anyio_lock = anyio.Lock()
67+
self._anyio_lock = anyio.Lock(fast_acquire=True)
6868

6969
async def __aenter__(self) -> "AsyncLock":
7070
if not self._backend:
@@ -167,7 +167,7 @@ def setup(self) -> None:
167167
)
168168
elif self._backend == "asyncio":
169169
self._anyio_semaphore = anyio.Semaphore(
170-
initial_value=self._bound, max_value=self._bound
170+
initial_value=self._bound, max_value=self._bound, fast_acquire=True
171171
)
172172

173173
async def acquire(self) -> None:

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trio = [
4444
"trio>=0.22.0,<0.26.0",
4545
]
4646
asyncio = [
47-
"anyio>=4.0,<5.0",
47+
"anyio>=4.5.0,<5.0",
4848
]
4949

5050
[project.urls]

0 commit comments

Comments
 (0)