Title: Incompatible type when expanded-dict-as-kwargs used in named default argument position · Issue #5834 · python/mypy · GitHub
Open Graph Title: Incompatible type when expanded-dict-as-kwargs used in named default argument position · Issue #5834 · python/mypy
X Title: Incompatible type when expanded-dict-as-kwargs used in named default argument position · Issue #5834 · python/mypy
Description: (Please feel free to re-title this as necessary if I've misunderstood the short explanation) I believe I've found a bug that lies somewhere between a named default argument and keyword arguments that follow it, but specifically in the ca...
Open Graph Description: (Please feel free to re-title this as necessary if I've misunderstood the short explanation) I believe I've found a bug that lies somewhere between a named default argument and keyword arguments th...
X Description: (Please feel free to re-title this as necessary if I've misunderstood the short explanation) I believe I've found a bug that lies somewhere between a named default argument and keyword argu...
Opengraph URL: https://github.com/python/mypy/issues/5834
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Incompatible type when expanded-dict-as-kwargs used in named default argument position","articleBody":"_(Please feel free to re-title this as necessary if I've misunderstood the short explanation)_\r\n\r\nI believe I've found a bug that lies somewhere between a named default argument and keyword arguments that follow it, but specifically in the case where the kwargs come from a `**` expanded dict.\r\n\r\nHere is a minimal example of the function causing this:\r\n\r\n from typing import List\r\n\r\n def fn(x: str, y: bool=True, **kwargs: List[str]) -> None:\r\n print(x, y, kwargs)\r\n\r\nHere is an example of some calls to this function:\r\n\r\n fn(\"hello\", y=False) # ok\r\n fn(\"hello\", kw1=[\"a\", \"b\"], kw2=[\"c\", \"d\"]) # ok\r\n ...\r\n kwargs = {\"kw1\": [\"a\", \"b\"], \"kw2\": [\"c\", \"d\"]}\r\n fn(\"hello\", **kwargs) # functionally same as above, but error\r\n\r\nOn the third `fn` call I'll end up receiving the following error when running `mypy` on that code:\r\n\r\n error: Argument 2 to \"fn\" has incompatible type \"**Dict[str, List[str]]\"; expected \"bool\"\r\n\r\nMy general expectation was that this would work fine. This is seen while running with the following (with no special flags to the `mypy` run):\r\n\r\n $ mypy --version\r\n mypy 0.641\r\n $ python3 --version\r\n Python 3.7.0+\r\n\r\nI've also tried with master (`mypy 0.650+dev.e09e72775bfeb622e67cab7d5eae0f12ef4adefa`) and the behavior is the same.","author":{"url":"https://github.com/briancurtin","@type":"Person","name":"briancurtin"},"datePublished":"2018-10-24T14:56:25Z","url":"https://github.com/python/mypy/issues/5834"}
| 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:621150a4-978f-a67d-21f7-060394c4ed0b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A83A:2AD163:23FABA5:30ECF25:6B003008 |
| html-safe-nonce | c63cdc46b358ac95ccfea66432251b1b483747f1f68bcb37a3652f53a6750908 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBODNBOjJBRDE2MzoyM0ZBQkE1OjMwRUNGMjU6NkIwMDMwMDgiLCJ2aXNpdG9yX2lkIjoiODMzMTc1NjkxOTg1NzM2MDkwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 60142947bb9204b21d8f4a67341ce527da21a083db017388b192a23d87bc68cb |
| hovercard-subject-tag | issue:373526846 |
| 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/5834/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2681ba638def20cd638c52d5fc20f934a8859d5396692b7cf45f6d4fe33cd410/python/mypy/issues/5834 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2681ba638def20cd638c52d5fc20f934a8859d5396692b7cf45f6d4fe33cd410/python/mypy/issues/5834 |
| og:image:alt | (Please feel free to re-title this as necessary if I've misunderstood the short explanation) I believe I've found a bug that lies somewhere between a named default argument and keyword arguments th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | briancurtin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width