This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients JelleZijlstra, gvanrossum, levkivskyi, serhiy.storchaka
Date 2020-05-09.19:17:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1589051854.85.0.488848728134.issue40397@roundup.psfhosted.org>
In-reply-to
Content
@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. :-(
History
Date User Action Args
2020-05-09 19:17:34gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, levkivskyi, JelleZijlstra
2020-05-09 19:17:34gvanrossumsetmessageid: <1589051854.85.0.488848728134.issue40397@roundup.psfhosted.org>
2020-05-09 19:17:34gvanrossumlinkissue40397 messages
2020-05-09 19:17:34gvanrossumcreate