Commit 32d6b58
committed
[mypyc] Fix evaluation of iterable in list comprehension twice
This could result in a crash if the second evaluation results
in a shorter list, such as in this example (besides being incorrect
overall):
```
a = [s for s in f.readlines()]
```
`f.readlines()` was called twice, resulting in an empty list on
the second call. This caused the list object to have a NULL item,
which is invalid.
This should fix `mypy --install-types` in compiled mode.1 parent b68993c commit 32d6b58
2 files changed
+23
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 168 | + | |
| 169 | + | |
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | | - | |
| 176 | + | |
176 | 177 | | |
177 | 178 | | |
178 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
| 488 | + | |
| 489 | + | |
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
| |||
498 | 500 | | |
499 | 501 | | |
500 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
501 | 514 | | |
502 | 515 | | |
503 | 516 | | |
| |||
506 | 519 | | |
507 | 520 | | |
508 | 521 | | |
509 | | - | |
| 522 | + | |
510 | 523 | | |
511 | 524 | | |
512 | 525 | | |
| 526 | + | |
| 527 | + | |
513 | 528 | | |
514 | 529 | | |
515 | 530 | | |
| |||
0 commit comments