Repository navigation
Commit 741543f
Improve handling of "lambda: None" (#1557)
"lambda: None" might be used either where a function returning an
Optional[T] is expected, or where a function not returning a value is
expected. Previously it would always treated as the former; now the
context is used to decide.
When no context is available, mypy continues to treat the lambda as
returning the value None, rather than no value at all. When the other
meaning is desired, it is generally possible to provide a context, or
in any case to use a function defined with `def`.
Fixes #1425.1 parent 584f8f3 commit 741543f
3 files changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1350 | 1355 | | |
1351 | 1356 | | |
1352 | 1357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
614 | 621 | | |
615 | 622 | | |
616 | 623 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1044 | 1055 | | |
1045 | 1056 | | |
1046 | 1057 | | |
| |||
0 commit comments