Skip to content

Commit 11a5373

Browse files
committed
Skip deprecation of Sentinel class
1 parent d75ee9a commit 11a5373

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
@@ -446,12 +446,7 @@ def __reduce__(self) -> str:
446446
"""Reduce this sentinel to a singleton."""
447447
return self.__name__ # Module is taken from the __module__ attribute
448448

449-
with warnings.catch_warnings(): # Allow sentinel subclass for backwards compatibility
450-
warnings.simplefilter("ignore")
451-
452-
@deprecated("""Sentinel was renamed to typing_extensions.sentinel""")
453-
class Sentinel(sentinel):
454-
pass
449+
Sentinel = sentinel
455450

456451
_marker = sentinel("sentinel")
457452

0 commit comments

Comments
 (0)