mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-98852: Fix subscription of type aliases (GH-98920)
Fix subscription of type aliases containing bare generic types or types
like TypeVar: for example tuple[A, T][int] and tuple[TypeVar, T][int],
where A is a generic type, and T is a type variable.
(cherry picked from commit 0e15c31c7e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
217a317425
commit
20c258c692
4 changed files with 43 additions and 0 deletions
|
|
@ -1425,6 +1425,10 @@ def _determine_new_args(self, args):
|
|||
new_args = []
|
||||
for old_arg in self.__args__:
|
||||
|
||||
if isinstance(old_arg, type):
|
||||
new_args.append(old_arg)
|
||||
continue
|
||||
|
||||
substfunc = getattr(old_arg, '__typing_subst__', None)
|
||||
if substfunc:
|
||||
new_arg = substfunc(new_arg_by_param[old_arg])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue