Title: False positive with `**kwargs` with multiple arguments · Issue #18759 · python/mypy · GitHub
Open Graph Title: False positive with `**kwargs` with multiple arguments · Issue #18759 · python/mypy
X Title: False positive with `**kwargs` with multiple arguments · Issue #18759 · python/mypy
Description: To Reproduce def foo(x: int, y: str) -> None: return def bar() -> None: args = {"x": 123, "y": "abc"} foo(**args) https://mypy-play.net/?mypy=latest&python=3.12&gist=97467e43c0e316f2f9fd1d6f0c2bd432 Expected Behavior This should type che...
Open Graph Description: To Reproduce def foo(x: int, y: str) -> None: return def bar() -> None: args = {"x": 123, "y": "abc"} foo(**args) https://mypy-play.net/?mypy=latest&python=3.12&gist=97467e43c0e316f2f9fd1d6f0c2bd43...
X Description: To Reproduce def foo(x: int, y: str) -> None: return def bar() -> None: args = {"x": 123, "y": "abc"} foo(**args) https://mypy-play.net/?mypy=latest&python=3...
Opengraph URL: https://github.com/python/mypy/issues/18759
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"False positive with `**kwargs` with multiple arguments","articleBody":"**To Reproduce**\n\n```python\ndef foo(x: int, y: str) -> None:\n return\n\ndef bar() -> None:\n args = {\"x\": 123, \"y\": \"abc\"}\n foo(**args)\n```\nhttps://mypy-play.net/?mypy=latest&python=3.12&gist=97467e43c0e316f2f9fd1d6f0c2bd432\n\n**Expected Behavior**\n\nThis should type check without errors. It's fairly common and while not 100% safe, checking the type of `args` is not enough anyway -- you have to check the _values_ of the keys. This information is not present in types.\n\n**Actual Behavior**\n\nThis generates these errors:\n```\nmain.py:6: error: Argument 1 to \"foo\" has incompatible type \"**dict[str, object]\"; expected \"int\" [arg-type]\nmain.py:6: error: Argument 1 to \"foo\" has incompatible type \"**dict[str, object]\"; expected \"str\" [arg-type]\n```\nNote that two contradictory errors are generated on the same line.\n\n**Your Environment**\n\n- Mypy version used: 1.15.0\n- Python version used: 3.11, 3.12\n","author":{"url":"https://github.com/eltoder","@type":"Person","name":"eltoder"},"datePublished":"2025-03-06T16:56:49Z","url":"https://github.com/python/mypy/issues/18759"}
| 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:f86b3d9f-3841-4451-c80a-4241c4896c97 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D242:1A2F85:2FCBDF:408DF9:6B0026B9 |
| html-safe-nonce | eb9b350412090733ca73f63ac7254b2a2d13c6ca916ba8f9ba10e22fe9802231 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjQyOjFBMkY4NToyRkNCREY6NDA4REY5OjZCMDAyNkI5IiwidmlzaXRvcl9pZCI6IjM0OTExMTA2ODc0MTYwMDIyMzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 69802122b2cc84a4a2b9a6f9fcc956390caf220f81d42c3a542c45a454c98940 |
| hovercard-subject-tag | issue:2900943454 |
| 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/18759/issue_layout |
| twitter:image | https://opengraph.githubassets.com/78afc617ce8b5f82054ff782c8e17e056f0096561fcdda92262b0ed69fdbabf4/python/mypy/issues/18759 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/78afc617ce8b5f82054ff782c8e17e056f0096561fcdda92262b0ed69fdbabf4/python/mypy/issues/18759 |
| og:image:alt | To Reproduce def foo(x: int, y: str) -> None: return def bar() -> None: args = {"x": 123, "y": "abc"} foo(**args) https://mypy-play.net/?mypy=latest&python=3.12&gist=97467e43c0e316f2f9fd1d6f0c2bd43... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eltoder |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width