Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ValueError: list.remove(x): x not in list (#670) #680

Merged
merged 5 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion httpcore/_async/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ async def handle_async_request(self, request: Request) -> Response:
# sure to remove the request from the queue before bubbling
# up the exception.
async with self._pool_lock:
self._requests.remove(status)
# Ensure only remove when task exists.
if status in self._requests:
self._requests.remove(status)
raise exc

try:
Expand Down
4 changes: 3 additions & 1 deletion httpcore/_sync/connection_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,9 @@ def handle_request(self, request: Request) -> Response:
# sure to remove the request from the queue before bubbling
# up the exception.
with self._pool_lock:
self._requests.remove(status)
# Ensure only remove when task exists.
if status in self._requests:
self._requests.remove(status)
raise exc

try:
Expand Down