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 kj
Recipients gvanrossum, kj, mthe
Date 2021-07-07.14:24:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625667885.74.0.643087607567.issue44578@roundup.psfhosted.org>
In-reply-to
Content
Sorry, I don't think this will be fixed as it is intentional. types.GenericAlias (the type of list[int] or dict[str, str]) does almost 0 checking for two reasons IIUC:

- Types with wrong number of parameters will usually be caught by your IDE/type checker.
- Checking would add complexity and slow down runtime performance. The current implementation of GenericAlias in C is intentionally simple.

We can add a note in the docs noting that too many type parameters won't raise a TypeError. It would probably be here https://docs.python.org/3/library/stdtypes.html#generic-alias-type

BTW, I adjusted the issue's affected versions because this was introduced only in 3.9.
History
Date User Action Args
2021-07-07 14:24:45kjsetrecipients: + kj, gvanrossum, mthe
2021-07-07 14:24:45kjsetmessageid: <1625667885.74.0.643087607567.issue44578@roundup.psfhosted.org>
2021-07-07 14:24:45kjlinkissue44578 messages
2021-07-07 14:24:45kjcreate