diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-05-10 10:39:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-10 10:39:40 (GMT) |
commit | 0122d48681b1df27015cf396559fb283ba364d6d (patch) | |
tree | 3a1af9bb5c8a31fa65dd8ca3bf5395506a1443bf /Lib/typing.py | |
parent | 86a93fddf72a2711aca99afa0c5374c8d6b4a321 (diff) | |
download | cpython-0122d48681b1df27015cf396559fb283ba364d6d.zip cpython-0122d48681b1df27015cf396559fb283ba364d6d.tar.gz cpython-0122d48681b1df27015cf396559fb283ba364d6d.tar.bz2 |
bpo-40397: Fix subscription of nested generic alias without parameters. (GH-20021)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index e31fc99..b5ba38e 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -702,8 +702,10 @@ class _GenericAlias(_BaseGenericAlias, _root=True): if isinstance(arg, TypeVar): arg = subst[arg] elif isinstance(arg, (_GenericAlias, GenericAlias)): - subargs = tuple(subst[x] for x in arg.__parameters__) - arg = arg[subargs] + subparams = arg.__parameters__ + if subparams: + subargs = tuple(subst[x] for x in subparams) + arg = arg[subargs] new_args.append(arg) return self.copy_with(tuple(new_args)) |