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 <>
@Serhiy can you look at this? A possible fix might be:

diff --git a/Lib/ b/Lib/
index 681ab6d21e..adcef1e82b 100644
--- a/Lib/
+++ b/Lib/
@@ -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]
         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. :-(
Date User Action Args
2020-05-09 19:17:34gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, levkivskyi, JelleZijlstra
2020-05-09 19:17:34gvanrossumsetmessageid: <>
2020-05-09 19:17:34gvanrossumlinkissue40397 messages
2020-05-09 19:17:34gvanrossumcreate