Commit a4fe82b
committed
Require string-backed TypedDict enum keys
TypedDict indexing treated any string-valued LiteralType as a string literal, including ordinary enum members whose literal value stores the member name. Require the literal fallback to be a subtype of str, while preserving StrEnum and string-mixin enum keys.
Fixes #21722.1 parent 2e6c87e commit a4fe82b
2 files changed
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4817 | 4817 | | |
4818 | 4818 | | |
4819 | 4819 | | |
4820 | | - | |
| 4820 | + | |
4821 | 4821 | | |
4822 | 4822 | | |
4823 | 4823 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3004 | 3004 | | |
3005 | 3005 | | |
3006 | 3006 | | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
3007 | 3033 | | |
3008 | 3034 | | |
3009 | 3035 | | |
| |||
0 commit comments