Commit ab63d64
authored
Treat Literal["xyz"] as iterable (#20347)
The extra condition that excluded LiteralType was introduced in #14827.
I see no particular reason to have an instance check at all
I was looking at this because of this comment from Emma
#15511 (comment)
Previously we errored with `"Literal['xy']" object is not iterable`
which is of course totally false
Now I issue the same error as in the str case, but restrict to cases
where the unpack length does not match
Related to #203251 parent f1bb818 commit ab63d64
File tree
3 files changed
+35
-7
lines changed- mypy
- test-data/unit
3 files changed
+35
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4116 | 4116 | | |
4117 | 4117 | | |
4118 | 4118 | | |
| 4119 | + | |
4119 | 4120 | | |
| 4121 | + | |
| 4122 | + | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
4120 | 4130 | | |
| 4131 | + | |
4121 | 4132 | | |
4122 | 4133 | | |
4123 | 4134 | | |
| |||
4363 | 4374 | | |
4364 | 4375 | | |
4365 | 4376 | | |
4366 | | - | |
4367 | | - | |
4368 | | - | |
| 4377 | + | |
4369 | 4378 | | |
4370 | 4379 | | |
4371 | 4380 | | |
| |||
7803 | 7812 | | |
7804 | 7813 | | |
7805 | 7814 | | |
7806 | | - | |
7807 | | - | |
7808 | | - | |
| 7815 | + | |
7809 | 7816 | | |
7810 | 7817 | | |
7811 | 7818 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2517 | 2517 | | |
2518 | 2518 | | |
2519 | 2519 | | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
| 518 | + | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| |||
0 commit comments