Title: Spurious error on Callables returning None, under strict-optional · Issue #1957 · python/mypy · GitHub
Open Graph Title: Spurious error on Callables returning None, under strict-optional · Issue #1957 · python/mypy
X Title: Spurious error on Callables returning None, under strict-optional · Issue #1957 · python/mypy
Description: Under --strict-optional, something goes wrong in handling Callable types with return type None so that we don't allow them to be used even where the very same type is expected. Short repro: $ cat /tmp/foo.py from typing import Callable d...
Open Graph Description: Under --strict-optional, something goes wrong in handling Callable types with return type None so that we don't allow them to be used even where the very same type is expected. Short repro: $ cat /...
X Description: Under --strict-optional, something goes wrong in handling Callable types with return type None so that we don't allow them to be used even where the very same type is expected. Short repro: $ c...
Opengraph URL: https://github.com/python/mypy/issues/1957
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Spurious error on Callables returning None, under strict-optional","articleBody":"Under `--strict-optional`, something goes wrong in handling `Callable` types with return type `None` so that we don't allow them to be used even where the very same type is expected.\n\nShort repro:\n\n```\n$ cat /tmp/foo.py\nfrom typing import Callable\n\ndef f() -> None:\n ...\n\nx = f # type: Callable[[], None]\n\n$ mypy /tmp/foo.py --strict-optional\n/tmp/foo.py:6: error: Incompatible types in assignment (expression has type Callable[[], None], variable has type Callable[[], None])\n```\n\nThis is perfectly well-typed code, and we shouldn't be giving an error. Running `mypy --strict-optional` on mypy itself, there are 16 error messages that appear to be caused by this issue.\n\nThe error message itself also has the problem that it's complaining of incompatible types and then printing precisely the same type description twice. This may indicate a second independent bug; that'll become clearer with a diagnosis of this one.\n","author":{"url":"https://github.com/gnprice","@type":"Person","name":"gnprice"},"datePublished":"2016-07-29T01:46:13Z","url":"https://github.com/python/mypy/issues/1957"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:59b9b239-f2c3-625e-f81a-24b282a87569 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E5F2:23FDF9:1E6B15C:295EAD2:6B001971 |
| html-safe-nonce | 24754bb37c96622609134b4a5d2db442e50a4f28ca277600283977ea7362c384 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNUYyOjIzRkRGOToxRTZCMTVDOjI5NUVBRDI6NkIwMDE5NzEiLCJ2aXNpdG9yX2lkIjoiNTE1NzAyMzAxMjg0MjY0MTc3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d940c695a6b0986906cb799a8b647d8ec0dafcc33cf23ddde7f097f56ac30815 |
| hovercard-subject-tag | issue:168233880 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/1957/issue_layout |
| twitter:image | https://opengraph.githubassets.com/20905e844f543df88624616fd1ac6b14fbd076110717561cfeaae1f11c58337c/python/mypy/issues/1957 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/20905e844f543df88624616fd1ac6b14fbd076110717561cfeaae1f11c58337c/python/mypy/issues/1957 |
| og:image:alt | Under --strict-optional, something goes wrong in handling Callable types with return type None so that we don't allow them to be used even where the very same type is expected. Short repro: $ cat /... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gnprice |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width