Title: Passing an unpacked dictionary and keyword arguments to `**kwargs` gets unexpected errors · Issue #20650 · python/mypy · GitHub
Open Graph Title: Passing an unpacked dictionary and keyword arguments to `**kwargs` gets unexpected errors · Issue #20650 · python/mypy
X Title: Passing an unpacked dictionary and keyword arguments to `**kwargs` gets unexpected errors · Issue #20650 · python/mypy
Description: *Memo: mypy test.py mypy 1.19.1 Python 3.14.0 Passing an unpacked list and positional arguments to *args: *tuple[int, ...] doesn't get error as shown below: def func(*args: *tuple[int, ...]) -> None: ... func(*[0, 1, 2]) # No error func(...
Open Graph Description: *Memo: mypy test.py mypy 1.19.1 Python 3.14.0 Passing an unpacked list and positional arguments to *args: *tuple[int, ...] doesn't get error as shown below: def func(*args: *tuple[int, ...]) -> Non...
X Description: *Memo: mypy test.py mypy 1.19.1 Python 3.14.0 Passing an unpacked list and positional arguments to *args: *tuple[int, ...] doesn't get error as shown below: def func(*args: *tuple[int, ...]) -&...
Opengraph URL: https://github.com/python/mypy/issues/20650
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Passing an unpacked dictionary and keyword arguments to `**kwargs` gets unexpected errors","articleBody":"*Memo:\n- mypy test.py\n- mypy 1.19.1\n- Python 3.14.0\n\nPassing an unpacked list and positional arguments to `*args: *tuple[int, ...]` doesn't get error as shown below:\n\n```python\ndef func(*args: *tuple[int, ...]) -> None: ...\n\nfunc(*[0, 1, 2]) # No error\nfunc(0, 1, 2) # No error\n```\n\nBut, passing an unpacked dictionary and keyword arguments to `**kwargs: dict[str, int]` gets the errors as shown below:\n\n```python\ndef func(**kwargs: dict[str, int]) -> None: ...\n\nfunc(**{'A': 0, 'B': 1}) # Error\n```\n\n> error: Argument 1 to \"func\" has incompatible type \"**dict[str, int]\"; expected \"dict[str, int]\"\n\n> note: \"dict\" is invariant\n\n> note: Consider using \"Mapping\" instead, which is covariant in the value type\n\n```python\ndef func(**kwargs: dict[str, int]) -> None: ...\n\nfunc(A=0, B=1) # Error\n```\n\n> error: Argument \"A\" to \"func\" has incompatible type \"int\"; expected \"dict[str, int]\"\n\n> error: Argument \"B\" to \"func\" has incompatible type \"int\"; expected \"dict[str, int]\"\n\nAnd, passing an unpacked dictionary to `**kwargs: Unpack[Person]` based on [TypedDict](https://docs.python.org/3/library/typing.html#typing.TypedDict) gets the errors while passing keyword arguments to `**kwargs: Unpack[Person]` based on `TypedDict` doesn't get error as shown below:\n\n```python\nfrom typing import TypedDict, Unpack\n\nclass Person(TypedDict):\n name: str\n age: int\n\ndef func(**kwargs: Unpack[Person]) -> None: ...\n\nfunc(**{'name': 'John', 'age': 32}) # Error\nfunc(name='John', age=32) # No error\n```\n\n> error: Argument 1 to \"func\" has incompatible type \"**dict[str, object]\"; expected \"str\"\n\n> error: Argument 1 to \"func\" has incompatible type \"**dict[str, object]\"; expected \"int\"","author":{"url":"https://github.com/hyperkai","@type":"Person","name":"hyperkai"},"datePublished":"2026-01-25T13:46:22Z","url":"https://github.com/python/mypy/issues/20650"}
| 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:def54112-c43f-49b2-2384-dac38659455b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B864:9E1B2:29BB564:36CFE04:6B000CAE |
| html-safe-nonce | e9ed3cf1534d65a2c09445db871686f89cadc7a1562fd52e65fa89b3c4c495a3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODY0OjlFMUIyOjI5QkI1NjQ6MzZDRkUwNDo2QjAwMENBRSIsInZpc2l0b3JfaWQiOiIzMzIzMDA3MTI3NzM5NDM2MjA2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 49c53dd9a10eec5dbc1b37fe3daa6c55fb03e9467247595f9130707da2f81758 |
| hovercard-subject-tag | issue:3853276137 |
| 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/20650/issue_layout |
| twitter:image | https://opengraph.githubassets.com/72579264071a9b66399a62e9f61f79f5d89c4af394c3ca322fb1a97ef11b1516/python/mypy/issues/20650 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/72579264071a9b66399a62e9f61f79f5d89c4af394c3ca322fb1a97ef11b1516/python/mypy/issues/20650 |
| og:image:alt | *Memo: mypy test.py mypy 1.19.1 Python 3.14.0 Passing an unpacked list and positional arguments to *args: *tuple[int, ...] doesn't get error as shown below: def func(*args: *tuple[int, ...]) -> Non... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hyperkai |
| hostname | github.com |
| expected-hostname | github.com |
| None | cf7ee0062053ad9eb05b6e5de57bd96c2055708bcbada4144946b5ec129cf1d7 |
| 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 | 9cab7de176a56362d2aabcbb4d1e07e846eba8a0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width