Message397088
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. |
|
Date |
User |
Action |
Args |
2021-07-07 14:24:45 | kj | set | recipients:
+ kj, gvanrossum, mthe |
2021-07-07 14:24:45 | kj | set | messageid: <1625667885.74.0.643087607567.issue44578@roundup.psfhosted.org> |
2021-07-07 14:24:45 | kj | link | issue44578 messages |
2021-07-07 14:24:45 | kj | create | |
|