Guido van Rossum <[email protected]> added the comment:
@Serhiy can you look at this? A possible fix might be:
diff --git a/Lib/typing.py b/Lib/typing.py
index 681ab6d21e..adcef1e82b 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -701,7 +701,8 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
arg = subst[arg]
elif isinstance(arg, (_BaseGenericAlias, GenericAlias)):
subargs = tuple(subst[x] for x in arg.__parameters__)
- arg = arg[subargs]
+ if subargs:
+ arg = arg[subargs]
new_args.append(arg)
return self.copy_with(tuple(new_args))
The immediate cause of the problem seems to be that we call arg[subargs] with
subargs being (). So arg is a _GenericAlias but its __parameters__ is (). I'm
not sure what path was taken previously. :-(
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40397>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com