Skip to content

Commit

Permalink
Fix float("inf") timeouts (#846)
Browse files Browse the repository at this point in the history
* Fix float timeouts in synchronous event

* Changelog
  • Loading branch information
karpetrosyan authored Nov 8, 2023
1 parent 9c818e9 commit 1e7597b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

- Fix `float("inf")` timeouts in `Event.wait` function. (#846)

## 1.0.1 (November 3rd, 2023)

- Fix pool timeout to account for the total time spent retrying. (#823)
Expand Down
2 changes: 2 additions & 0 deletions httpcore/_synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def set(self) -> None:
self._event.set()

def wait(self, timeout: Optional[float] = None) -> None:
if timeout == float("inf"): # pragma: no cover
timeout = None
if not self._event.wait(timeout=timeout):
raise PoolTimeout() # pragma: nocover

Expand Down

0 comments on commit 1e7597b

Please sign in to comment.