Title: False positive error on `**kwargs` with `Mapping[Literal, Any]` type · Issue #20424 · python/mypy · GitHub
Open Graph Title: False positive error on `**kwargs` with `Mapping[Literal, Any]` type · Issue #20424 · python/mypy
X Title: False positive error on `**kwargs` with `Mapping[Literal, Any]` type · Issue #20424 · python/mypy
Description: https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748 Mypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8 Fixed by: #20419 See Also: #20416 from typing import Literal, Mapping, I...
Open Graph Description: https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748 Mypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8 Fixed by: #20419 See Also: #2041...
X Description: https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748 Mypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8 Fixed by: #20419 See...
Opengraph URL: https://github.com/python/mypy/issues/20424
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive error on `**kwargs` with `Mapping[Literal, Any]` type","articleBody":"https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748\n\nMypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8\n\nFixed by: #20419\n\nSee Also: #20416\n\n```python\nfrom typing import Literal, Mapping, Iterable\ndef func(a: int, b: int) -> None: ...\n\nclass GOOD_KW:\n def keys(self) -> Iterable[Literal[\"a\", \"b\"]]: ...\n def __getitem__(self, key: str) -> int: ...\n\nclass BAD_KW:\n def keys(self) -> Iterable[Literal[\"one\", 1]]: ...\n def __getitem__(self, key: str) -> int: ...\n\ndef test(\n good_kw: GOOD_KW,\n bad_kw: BAD_KW,\n good_dict: dict[Literal[\"a\", \"b\"], int],\n bad_dict: dict[Literal[\"one\", 1], int],\n good_mapping: Mapping[Literal[\"a\", \"b\"], int],\n bad_mapping: Mapping[Literal[\"one\", 1], int],\n) -> None:\n func(**good_kw)\n func(**bad_kw) # E: Argument after ** must have string keys\n func(**good_dict)\n func(**bad_dict) # E: Argument after ** must have string keys\n func(**good_mapping) # ❌️ False positive\n func(**bad_mapping) # E: Argument after ** must have string keys\n```\n\n\n\n","author":{"url":"https://github.com/randolf-scholz","@type":"Person","name":"randolf-scholz"},"datePublished":"2025-12-16T09:08:08Z","url":"https://github.com/python/mypy/issues/20424"}
| 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:605ee8df-c2ac-aa9d-603a-5d5cb952ece6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8916:3F7946:22125BA:2E6BAEC:6B002A59 |
| html-safe-nonce | d2482f27ece359b078c1dba30a287f70c34c19e690da871651ba42a2e93550bb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTE2OjNGNzk0NjoyMjEyNUJBOjJFNkJBRUM6NkIwMDJBNTkiLCJ2aXNpdG9yX2lkIjoiODA1ODgzODcxMDk3NzkzMTEzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d7965c166509fee399519e24e449c426e316d04c89fe11c7962320c71b63513b |
| hovercard-subject-tag | issue:3733869837 |
| 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/20424/issue_layout |
| twitter:image | https://opengraph.githubassets.com/45a1ff87724cd03809a60caf9bea24f8dd904f193367f92de5d65888f4211219/python/mypy/issues/20424 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/45a1ff87724cd03809a60caf9bea24f8dd904f193367f92de5d65888f4211219/python/mypy/issues/20424 |
| og:image:alt | https://mypy-play.net/?mypy=master&python=3.12&flags=verbose&gist=c3db401cf676c8c593dec1c525f7e748 Mypy Version: 1.20.0+dev.d06d3d9cfd6611c0e64c0df59fc0449754e47ed8 Fixed by: #20419 See Also: #2041... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | randolf-scholz |
| 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