Skip to content

Commit 4e6f432

Browse files
support any bool'ish types
1 parent df08c29 commit 4e6f432

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

asyncstdlib/builtins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ async def _min_max(
305305
raise ValueError(f"{name}() arg is an empty sequence")
306306
elif key is None:
307307
async for item in item_iter:
308-
if invert ^ (item < best):
308+
if invert ^ bool(item < best):
309309
best = item
310310
else:
311311
key = _awaitify(key)

asyncstdlib/heapq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async def pull_head(self) -> bool:
9292
return True
9393

9494
def __lt__(self, other: _KeyIter[LT]) -> bool:
95-
return self.reverse ^ (self.head_key < other.head_key)
95+
return self.reverse ^ bool(self.head_key < other.head_key)
9696

9797
def __eq__(self, other: _KeyIter[LT]) -> bool: # type: ignore[override]
9898
return not (self.head_key < other.head_key or other.head_key < self.head_key)
@@ -161,7 +161,7 @@ def __init__(self, key: LT):
161161
self.key = key
162162

163163
def __lt__(self, other: ReverseLT[LT]) -> bool:
164-
return other.key < self.key
164+
return bool(other.key < self.key)
165165

166166

167167
# Python's heapq provides a *min*-heap

0 commit comments

Comments
 (0)