Commit b2f9432
committed
Allow instantiating type[None] / types.NoneType
analyze_type_type_callee() had no case for mypy's internal NoneType,
so calling a value of type type[None] (e.g. via type(None)() or a
type[None]/type[types.NoneType] annotated callee) incorrectly
produced a "Cannot instantiate type" error, even though this is valid
at runtime and returns None.
Fixes #196601 parent 630b101 commit b2f9432
2 files changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1940 | 1940 | | |
1941 | 1941 | | |
1942 | 1942 | | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
1943 | 1948 | | |
1944 | 1949 | | |
1945 | 1950 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3913 | 3913 | | |
3914 | 3914 | | |
3915 | 3915 | | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
3916 | 3932 | | |
3917 | 3933 | | |
3918 | 3934 | | |
| |||
0 commit comments