Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fadc1ed

Browse filesBrowse files
authored
Remove PEP-604 methods from Sentinel on Python <3.10 (#605)
We don't generally try to "backport PEP 604" on Python <3.10; this is more consistent with our features
1 parent 44de568 commit fadc1ed
Copy full SHA for fadc1ed

File tree

Expand file treeCollapse file tree

2 files changed

+12
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-4
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Unreleased
2+
3+
- Remove `__or__` and `__ror__` methods from `typing_extensions.Sentinel`
4+
on Python versions <3.10. PEP 604 was introduced in Python 3.10, and
5+
`typing_extensions` does not generally attempt to backport PEP-604 methods
6+
to prior versions.
7+
18
# Release 4.14.0rc1 (May 24, 2025)
29

310
- Drop support for Python 3.8 (including PyPy-3.8). Patch by [Victorien Plot](https://github.com/Viicos).

‎src/typing_extensions.py

Copy file name to clipboardExpand all lines: src/typing_extensions.py
+5-4Lines changed: 5 additions & 4 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]
4247+
if sys.version_info >= (3, 10):
4248+
def __or__(self, other):
4249+
return typing.Union[self, other]
42494250

4250-
def __ror__(self, other):
4251-
return typing.Union[other, self]
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.