Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ aliases that have a `Concatenate` special form as their argument.
to reflect Python 3.13+ behavior: A value assigned to `__total__` in the class body of a
`TypedDict` will be overwritten by the `total` argument of the `TypedDict` constructor.
Patch by [Daraan](https://github.com/Daraan), backporting a CPython PR by Jelle Zijlstra.
- Fix for Python 3.11 that now `isinstance(typing_extensions.Unpack[...], TypeVar)`
evaluates to `False`, however still `True` for <3.11.
Patch by [Daraan](https://github.com/Daraan)

# Release 4.12.2 (June 7, 2024)

Expand Down
6 changes: 6 additions & 0 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6172,6 +6172,12 @@ def test_equivalent_nested_variadics(self):
self.assertEqual(nested_tuple_bare, TupleAliasTsT[Unpack[Tuple[str, int]], object])
self.assertEqual(nested_tuple_bare, TupleAliasTsT[Unpack[Tuple[str]], Unpack[Tuple[int]], object])

@skipUnless(TYPING_3_11_0, "Needed for backport")
def test_type_var_inheritance(self):
Ts = TypeVarTuple("Ts")
self.assertFalse(isinstance(Unpack[Ts], TypeVar))
self.assertFalse(isinstance(Unpack[Ts], typing.TypeVar))


class TypeVarTupleTests(BaseTestCase):

Expand Down
4 changes: 3 additions & 1 deletion src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2657,7 +2657,9 @@ def __init__(self, getitem):
self.__doc__ = _UNPACK_DOC

class _UnpackAlias(typing._GenericAlias, _root=True):
__class__ = typing.TypeVar
if sys.version_info < (3, 11):
# needed for compatibility with Generic[Unpack[Ts]]
__class__ = typing.TypeVar

@property
def __typing_unpacked_tuple_args__(self):
Expand Down
Loading