Skip to content

Commit c9fba13

Browse files
authored
Remove PEP-604 methods from Sentinel on Python <3.10
We don't generally try to "backport PEP 604" on Python <3.10; this is more consistent with our features
1 parent 44de568 commit c9fba13

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/typing_extensions.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4244,11 +4244,12 @@ def __repr__(self):
42444244
def __call__(self, *args, **kwargs):
42454245
raise TypeError(f"{type(self).__name__!r} object is not callable")
42464246

4247-
def __or__(self, other):
4248-
return typing.Union[self, other]
4249-
4250-
def __ror__(self, other):
4251-
return typing.Union[other, self]
4247+
if sys.version_info >= (3, 10):
4248+
def __or__(self, other):
4249+
return typing.Union[self, other]
4250+
4251+
def __ror__(self, other):
4252+
return typing.Union[other, self]
42524253

42534254
def __getstate__(self):
42544255
raise TypeError(f"Cannot pickle {type(self).__name__!r} object")

0 commit comments

Comments
 (0)