Skip to content

Commit 4347db2

Browse files
committed
Revert and use typing_extensions.deprecated instead
1 parent 3b14df2 commit 4347db2

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ dependencies = [
5050
# cffi is required on Windows, except on PyPy where it is built-in
5151
"cffi>=1.14; os_name == 'nt' and implementation_name != 'pypy'",
5252
"exceptiongroup; python_version < '3.11'",
53+
# using typing_extensions.depreciated in _sync.py
54+
"typing_extensions >= 4.15.0",
5355
]
5456
dynamic = ["version"]
5557

src/trio/_sync.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import TYPE_CHECKING, Literal, Protocol
55

66
import attrs
7+
from typing_extensions import deprecated
78

89
import trio
910

@@ -113,17 +114,16 @@ def statistics(self) -> EventStatistics:
113114
"""
114115
return EventStatistics(tasks_waiting=len(self._tasks))
115116

116-
if not TYPE_CHECKING:
117-
118-
def __bool__(self) -> Literal[True]:
119-
"""Return True and raise warning."""
120-
warn_deprecated(
121-
self.__bool__,
122-
"0.31.0",
123-
issue=3238,
124-
instead=self.is_set,
125-
)
126-
return True
117+
@deprecated
118+
def __bool__(self) -> Literal[True]:
119+
"""Return True and raise warning."""
120+
warn_deprecated(
121+
self.__bool__,
122+
"0.31.0",
123+
issue=3238,
124+
instead=self.is_set,
125+
)
126+
return True
127127

128128

129129
class _HasAcquireRelease(Protocol):

0 commit comments

Comments
 (0)