Skip to content
Open
Changes from 2 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
8 changes: 7 additions & 1 deletion src/trio/_sync.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import math
from typing import TYPE_CHECKING, Protocol
from typing import TYPE_CHECKING, NoReturn, Protocol

import attrs

Expand Down Expand Up @@ -112,6 +112,12 @@ def statistics(self) -> EventStatistics:
"""
return EventStatistics(tasks_waiting=len(self._tasks))

def __bool__(self) -> NoReturn:
"""Raise NotImplementedError."""
raise NotImplementedError(
"Trio events cannot be treated as bools; consider using 'event.is_set()'"
)


class _HasAcquireRelease(Protocol):
"""Only classes with acquire() and release() can use the mixin's implementations."""
Expand Down
Loading