Title: Internal error with an alias type that is a callable with an unpacked tuple as args · Issue #16533 · python/mypy · GitHub
Open Graph Title: Internal error with an alias type that is a callable with an unpacked tuple as args · Issue #16533 · python/mypy
X Title: Internal error with an alias type that is a callable with an unpacked tuple as args · Issue #16533 · python/mypy
Description: Bug Report Mypy crashes (errors) when using an aliased Callable with an unpacked Tuple within the arguments part. The definition throws no errors and using the type without the use of an alias is also working fine. mypy version: 1.7.0 py...
Open Graph Description: Bug Report Mypy crashes (errors) when using an aliased Callable with an unpacked Tuple within the arguments part. The definition throws no errors and using the type without the use of an alias is a...
X Description: Bug Report Mypy crashes (errors) when using an aliased Callable with an unpacked Tuple within the arguments part. The definition throws no errors and using the type without the use of an alias is a...
Opengraph URL: https://github.com/python/mypy/issues/16533
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Internal error with an alias type that is a callable with an unpacked tuple as args","articleBody":"**Bug Report**\r\n\r\nMypy crashes (errors) when using an aliased `Callable` with an unpacked `Tuple` within the arguments part. The definition throws no errors and using the type without the use of an alias is also working fine.\r\n\r\nmypy version: 1.7.0\r\npython version: 3.11.2\r\n\r\n**To Reproduce**\r\n\r\nThis is the smallest reproduction I could come up with. The error occours with the definition of `f2` where the type alias `_CallableValue` is used.\r\n\r\n```python\r\nfrom typing import Callable, Any, Tuple, Unpack\r\n\r\n\r\n_CallableValue = Callable[[Unpack[Tuple[Any, ...]]], Any] # This is fine\r\n\r\ndef f(fun: Callable[[Unpack[Tuple[Any, ...]]], Any]) -> None: ... # This is fine\r\n\r\ndef f2(fun: _CallableValue) -> None: ... # Mypy errors here with an internal error\r\n\r\n```\r\n([Playground](https://mypy-play.net/?mypy=1.7.0&python=3.11&flags=show-traceback&gist=9adb1b244c3693114130f82525cf42c8))\r\n\r\n**Expected Behavior**\r\n\r\nI would expect mypy to not have an internal error and instead produce a success result.\r\n\r\n**Actual Behavior**\r\n\r\nMypy has an internal error.\r\n\r\nOutput with my projects environment (VSCode, Python 3.11.2, mypy 1.7.0 (compiled: yes)):\r\n\r\n```Stacktrace\r\n2023-11-21 12:20:06.389 [info] [Trace - 12:20:06 PM] Sending notification 'textDocument/didSave'.\r\n2023-11-21 12:20:06.397 [info] [Trace - 12:20:06 PM] Received notification 'window/logMessage'.\r\n2023-11-21 12:20:06.397 [info] venv/Scripts/python.exe -m mypy --no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --show-traceback --show-error-end c:\\Users\\[PROJECT_PATH]\\.vscode\\mypytest.py\r\n2023-11-21 12:20:06.398 [info] [Trace - 12:20:06 PM] Received notification 'window/logMessage'.\r\n2023-11-21 12:20:06.398 [info] CWD Server: c:\\Users\\[PROJECT_PATH]\r\n2023-11-21 12:20:07.125 [info] [Trace - 12:20:07 PM] Received notification 'window/logMessage'.\r\n2023-11-21 12:20:07.125 [info] c:\\Users\\[PROJECT_PATH]\\.vscode\\mypytest.py:7: 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.7.0\r\nc:\\Users\\[PROJECT_PATH]\\.vscode\\mypytest.py:7: : note: use --pdb to drop into pdb\r\n\r\n2023-11-21 12:20:07.126 [info] [Trace - 12:20:07 PM] Received notification 'window/logMessage'.\r\n2023-11-21 12:20:07.126 [info] file:///c%3A/Users/[PROJECT_PATH]/.vscode/mypytest.py :\r\nTraceback (most recent call last):\r\n File \"\u003cfrozen runpy>\", line 198, in _run_module_as_main\r\n File \"\u003cfrozen runpy>\", line 88, in _run_code\r\n File \"mypy\\semanal.py\", line 6525, in accept\r\n File \"mypy\\nodes.py\", line 785, in accept\r\n File \"mypy\\semanal.py\", line 832, in visit_func_def\r\n File \"mypy\\semanal.py\", line 866, in analyze_func_def\r\n File \"mypy\\semanal_shared.py\", line 373, in has_placeholder\r\n File \"mypy\\types.py\", line 1964, in accept\r\n File \"mypy\\type_visitor.py\", line 505, in visit_callable_type\r\n File \"mypy\\type_visitor.py\", line 557, in query_types\r\n File \"mypy\\types.py\", line 395, in accept\r\n File \"mypy\\type_visitor.py\", line 550, in visit_type_alias_type\r\n File \"mypy\\types.py\", line 3072, in get_proper_type\r\n File \"mypy\\types.py\", line 337, in _expand_once\r\n File \"mypy\\types.py\", line 1964, in accept\r\n File \"mypy\\expandtype.py\", line 368, in visit_callable_type\r\n File \"mypy\\expandtype.py\", line 317, in interpolate_args_for_unpack\r\nAssertionError: \r\n\r\n2023-11-21 12:20:07.126 [info] [Trace - 12:20:07 PM] Received notification 'window/logMessage'.\r\n2023-11-21 12:20:07.126 [info] file:///c%3A/Users/[PROJECT_PATH]/.vscode/mypytest.py :\r\nTraceback (most recent call last):\r\n File \"\u003cfrozen runpy>\", line 198, in _run_module_as_main\r\n File \"\u003cfrozen runpy>\", line 88, in _run_code\r\n File \"mypy\\semanal.py\", line 6525, in accept\r\n File \"mypy\\nodes.py\", line 785, in accept\r\n File \"mypy\\semanal.py\", line 832, in visit_func_def\r\n File \"mypy\\semanal.py\", line 866, in analyze_func_def\r\n File \"mypy\\semanal_shared.py\", line 373, in has_placeholder\r\n File \"mypy\\types.py\", line 1964, in accept\r\n File \"mypy\\type_visitor.py\", line 505, in visit_callable_type\r\n File \"mypy\\type_visitor.py\", line 557, in query_types\r\n File \"mypy\\types.py\", line 395, in accept\r\n File \"mypy\\type_visitor.py\", line 550, in visit_type_alias_type\r\n File \"mypy\\types.py\", line 3072, in get_proper_type\r\n File \"mypy\\types.py\", line 337, in _expand_once\r\n File \"mypy\\types.py\", line 1964, in accept\r\n File \"mypy\\expandtype.py\", line 368, in visit_callable_type\r\n File \"mypy\\expandtype.py\", line 317, in interpolate_args_for_unpack\r\nAssertionError: \r\n\r\n2023-11-21 12:20:07.126 [info] [Trace - 12:20:07 PM] Received notification 'textDocument/publishDiagnostics'.\r\n```\r\n\r\nPlayground gist output (Python 3.11 and mypy 1.7.0)\r\n\r\n```stacktrace\r\nFailed (exit code: 2) (3302 ms)\r\n\r\nTraceback (most recent call last):\r\n File \"\u003cfrozen runpy>\", line 198, in _run_module_as_main\r\n File \"\u003cfrozen runpy>\", line 88, in _run_code\r\n File \"mypy/semanal.py\", line 6525, in accept\r\n File \"mypy/nodes.py\", line 785, in accept\r\n File \"mypy/semanal.py\", line 832, in visit_func_def\r\n File \"mypy/semanal.py\", line 866, in analyze_func_def\r\n File \"mypy/semanal_shared.py\", line 373, in has_placeholder\r\n File \"mypy/types.py\", line 1964, in accept\r\n File \"mypy/type_visitor.py\", line 505, in visit_callable_type\r\n File \"mypy/type_visitor.py\", line 557, in query_types\r\n File \"mypy/types.py\", line 395, in accept\r\n File \"mypy/type_visitor.py\", line 550, in visit_type_alias_type\r\n File \"mypy/types.py\", line 3072, in get_proper_type\r\n File \"mypy/types.py\", line 337, in _expand_once\r\n File \"mypy/types.py\", line 1964, in accept\r\n File \"mypy/expandtype.py\", line 368, in visit_callable_type\r\n File \"mypy/expandtype.py\", line 317, in interpolate_args_for_unpack\r\nAssertionError: \r\n\r\nmain.py:8: 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.7.0\r\nmain.py:8: : note: use --pdb to drop into pdb\r\n```\r\n\r\n**Your Environment**\r\n\r\n- Mypy version used: 1.7.0 (compiled: yes)\r\n- Mypy command-line flags: `-no-color-output --no-error-summary --show-absolute-path --show-column-numbers --show-error-codes --no-pretty --show-traceback --show-error-end c:\\Users\\[PROJECT_PATH]\\.vscode\\mypytest.py`\r\n- Mypy configuration options from `mypy.ini` (and other config files):\r\n```cfg\r\n[mypy]\r\nplugins = pydantic.mypy\r\nfollow_imports = silent\r\nwarn_redundant_casts = True\r\ndisallow_untyped_defs = True\r\ndisallow_any_unimported = False\r\nno_implicit_optional = True\r\ncheck_untyped_defs = True\r\nwarn_return_any = True\r\nshow_error_codes = True\r\nwarn_unused_ignores = True\r\n```\r\n- Python version used: 3.11.2\r\n\r\n(It's reproducable on the mypy playground, please see the \"Playground\"-link at the bottom of the \"To Reproduce\"-section.)\r\n\r\n","author":{"url":"https://github.com/Drache91","@type":"Person","name":"Drache91"},"datePublished":"2023-11-21T11:53:15Z","url":"https://github.com/python/mypy/issues/16533"}
| 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:8014aaf2-e4cb-663f-d82c-b10b7cfb7855 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDAE:354B:53F6AD:6D63A8:6AFFC443 |
| html-safe-nonce | 99f7d161d7715e1ce935edbfea53ca6418d83015ebf240ea3bb1793d239b2495 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREFFOjM1NEI6NTNGNkFEOjZENjNBODo2QUZGQzQ0MyIsInZpc2l0b3JfaWQiOiIzODIzNDcyNjE3MDM4MjY3NDU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3068c6de93105520685c9c5ca4e545b30156e0ce711b884648db403ac833e53c |
| hovercard-subject-tag | issue:2004110272 |
| 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/16533/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bdd30083daa4b9664ee20784c85c78cd4359e67dfc1a22a31b770846b6abf799/python/mypy/issues/16533 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bdd30083daa4b9664ee20784c85c78cd4359e67dfc1a22a31b770846b6abf799/python/mypy/issues/16533 |
| og:image:alt | Bug Report Mypy crashes (errors) when using an aliased Callable with an unpacked Tuple within the arguments part. The definition throws no errors and using the type without the use of an alias is a... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Drache91 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf |
| 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 | 8fa4a54e6871c7908eda1c246ad5972982c0b59d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width