Title: Crash with functools.partial and Unpack · Issue #17405 · python/mypy · GitHub
Open Graph Title: Crash with functools.partial and Unpack · Issue #17405 · python/mypy
X Title: Crash with functools.partial and Unpack · Issue #17405 · python/mypy
Description: Crash Report Crash first introduced with the new plugin for functools.partial in #16939. /CC @hauntsaninja Traceback $ mypy test.py --show-traceback test.py:11: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://myp...
Open Graph Description: Crash Report Crash first introduced with the new plugin for functools.partial in #16939. /CC @hauntsaninja Traceback $ mypy test.py --show-traceback test.py:11: error: INTERNAL ERROR -- Please try ...
X Description: Crash Report Crash first introduced with the new plugin for functools.partial in #16939. /CC @hauntsaninja Traceback $ mypy test.py --show-traceback test.py:11: error: INTERNAL ERROR -- Please try ...
Opengraph URL: https://github.com/python/mypy/issues/17405
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash with functools.partial and Unpack","articleBody":"**Crash Report**\r\nCrash first introduced with the new plugin for `functools.partial` in https://github.com/python/mypy/pull/16939.\r\n/CC @hauntsaninja\r\n\r\n**Traceback**\r\n\r\n```py\r\n$ mypy test.py --show-traceback\r\ntest.py:11: error: INTERNAL ERROR -- Please try using mypy master on GitHub:\r\nhttps://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 1.11.0+dev.10f18a82b612b6127659cd64aa60c10b9cc7a904\r\nTraceback (most recent call last):\r\n ...\r\n File \".../mypy/plugins/functools.py\", line 247, in partial_call_callback\r\n result = ctx.api.expr_checker.check_call(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \".../mypy/checkexpr.py\", line 1554, in check_call\r\n return self.check_callable_call(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \".../mypy/checkexpr.py\", line 1643, in check_callable_call\r\n callee = callee.with_unpacked_kwargs().with_normalized_var_args()\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \".../mypy/types.py\", line 2087, in with_unpacked_kwargs\r\n assert isinstance(last_type, TypedDictType)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nAssertionError:\r\n```\r\n\r\n**To Reproduce**\r\n\r\n```py\r\nfrom typing import TypedDict, Unpack\r\nfrom functools import partial\r\n\r\nclass Data(TypedDict, total=False):\r\n a1: int\r\n\r\ndef f(**kwargs: Unpack[Data]) -> None:\r\n ...\r\n\r\ndef g(**kwargs: Unpack[Data]) -> None:\r\n partial(f, **kwargs)()\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: `1.11.0+dev.10f18a82b612b6127659cd64aa60c10b9cc7a904` (current master)\r\n- Python version used: `3.12`\r\n\r\n--\r\nChanging the example slightly to add a second variable to `Data` results in new errors but the crash goes away.\r\n```py\r\nfrom typing import TypedDict, Unpack\r\nfrom functools import partial\r\n\r\nclass Data(TypedDict, total=False):\r\n a1: int\r\n a2: int # \u003c-- new\r\n\r\ndef f(**kwargs: Unpack[Data]) -> None:\r\n ...\r\n\r\ndef g(**kwargs: Unpack[Data]) -> None:\r\n partial(f, **kwargs)()\r\n```\r\n```py\r\ntest.py:12: error: \"f\" gets multiple values for keyword argument \"a1\" [misc]\r\ntest.py:12: error: \"f\" gets multiple values for keyword argument \"a2\" [misc]\r\n```\r\n","author":{"url":"https://github.com/cdce8p","@type":"Person","name":"cdce8p"},"datePublished":"2024-06-19T08:21:15Z","url":"https://github.com/python/mypy/issues/17405"}
| 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:b5e498ec-d3e8-5510-40da-6729ffc0e79c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBFE:B1603:294AA4C:362E433:6B000AF2 |
| html-safe-nonce | 8d3276e41e474bc552b120138dccf3f57a7aace0032bdd39b7353694c76165ce |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkZFOkIxNjAzOjI5NEFBNEM6MzYyRTQzMzo2QjAwMEFGMiIsInZpc2l0b3JfaWQiOiIyMzMwNTYzNzEzMTg4MjM2MDE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3f829e5281cb2553684abe1cf3c8bf4081d435ded9027541a1b120e2108da5fc |
| hovercard-subject-tag | issue:2361701338 |
| 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/17405/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a7df490802a0b949917d24433de65d81dd620483548e1566bc7b506f962a8dac/python/mypy/issues/17405 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a7df490802a0b949917d24433de65d81dd620483548e1566bc7b506f962a8dac/python/mypy/issues/17405 |
| og:image:alt | Crash Report Crash first introduced with the new plugin for functools.partial in #16939. /CC @hauntsaninja Traceback $ mypy test.py --show-traceback test.py:11: error: INTERNAL ERROR -- Please try ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cdce8p |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width