Skip to content

Commit 0a6544b

Browse files
committed
Skip deprecation of Sentinel class
1 parent ab1c49d commit 0a6544b

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

src/test_typing_extensions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9599,8 +9599,7 @@ def test_sentinel_deprecated(self):
95999599
class SentinelSubclass(Sentinel):
96009600
pass
96019601

9602-
with self.assertWarnsRegex(DeprecationWarning, r"Sentinel was renamed to typing_extensions.sentinel"):
9603-
my_sentinel = Sentinel(name="my_sentinel")
9602+
my_sentinel = Sentinel(name="my_sentinel")
96049603
with self.assertWarnsRegex(DeprecationWarning, r"Setting attributes on sentinel is deprecated"):
96059604
my_sentinel.foo = "bar"
96069605

src/typing_extensions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,7 @@ def __reduce__(self) -> str:
232232
"""Reduce this sentinel to a singleton."""
233233
return self.__name__ # Module is taken from the __module__ attribute
234234

235-
with warnings.catch_warnings(): # Allow sentinel subclass for backwards compatibility
236-
warnings.simplefilter("ignore")
237-
238-
@deprecated("""Sentinel was renamed to typing_extensions.sentinel""")
239-
class Sentinel(sentinel):
240-
pass
235+
Sentinel = sentinel
241236

242237
_marker = sentinel("sentinel")
243238

0 commit comments

Comments
 (0)