Skip to content

Commit 93950f2

Browse files
authored
Apply suggestions from code review
1 parent 68a4fad commit 93950f2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

newsfragments/3322.deprecated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Implement `trio.Event.__bool__` and have it raise a `DeprecationWarning` and tell users to use `trio.Event.is_set` instead. Would be caught earlier with `mypy --enable-error-code=truthy-bool`, this is for users who don't use mypy.
1+
Implement ``bool(trio.Event)`` and have it raise a `DeprecationWarning` and tell users to use `trio.Event.is_set` instead. This is an alternative to ``mypy --enable-error-code=truthy-bool`` for users who don't use type checking.

src/trio/_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def statistics(self) -> EventStatistics:
113113
"""
114114
return EventStatistics(tasks_waiting=len(self._tasks))
115115

116-
def __bool__(self) -> True:
116+
def __bool__(self) -> Literal[True]:
117117
"""Return True and raise warning."""
118118
warn_deprecated(
119119
self.__bool__,

0 commit comments

Comments
 (0)