Title: issue with ParamSpec and Callable of Callables · Issue #16405 · python/mypy · GitHub
Open Graph Title: issue with ParamSpec and Callable of Callables · Issue #16405 · python/mypy
X Title: issue with ParamSpec and Callable of Callables · Issue #16405 · python/mypy
Description: Bug Report When using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1 To Reproduce from typing import * T_Retval = TypeVar("T_Retval") P = ParamSpec(...
Open Graph Description: Bug Report When using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1 To Reproduce from typing import * T_Ret...
X Description: Bug Report When using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1 To Reproduce from typing import * T_Ret...
Opengraph URL: https://github.com/python/mypy/issues/16405
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"issue with ParamSpec and Callable of Callables","articleBody":"\u003c!--\r\nIf you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form instead.\r\nPlease consider:\r\n\r\n- checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html\r\n- searching our issue tracker: https://github.com/python/mypy/issues to see if it's already been reported\r\n- asking on gitter chat: https://gitter.im/python/typing\r\n-->\r\n\r\n**Bug Report**\r\nWhen using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1\r\n\r\n**To Reproduce**\r\n```python\r\nfrom typing import *\r\n\r\nT_Retval = TypeVar(\"T_Retval\")\r\nP = ParamSpec(\"P\")\r\n\r\n\r\ndef run(\r\n func: Callable[[], T_Retval],\r\n *args: object,\r\n backend: str = \"asyncio\",\r\n) -> T_Retval:\r\n return func()\r\n\r\n\r\ndef run_portal():\r\n pass\r\n\r\n\r\ndef submit(\r\n func: Callable[P, T_Retval],\r\n /,\r\n *args: P.args,\r\n **kwargs: P.kwargs,\r\n) -> T_Retval:\r\n return func(*args, **kwargs)\r\n\r\n\r\nsubmit(\r\n run,\r\n run_portal,\r\n backend=\"asyncio\",\r\n)\r\n```\r\nhttps://mypy-play.net/?mypy=1.6.1&python=3.11&gist=e282d121f479fcb77ec89daeb2a07b60\r\n\r\n**Expected Behavior**\r\n\r\nShould pass\r\n\r\n**Actual Behavior**\r\n```\r\nmain.py:29: error: Argument 1 to \"submit\" has incompatible type \"Callable[[Callable[[], T_Retval], VarArg(object), DefaultNamedArg(str, 'backend')], T_Retval]\"; expected \"Callable[[Callable[[], Any], str], T_Retval]\" [arg-type]\r\n```\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: 1.5.1 (passes) 1.6.1, 1.6.0, master (fails)\r\n- Mypy command-line flags:\r\n- Mypy configuration options from `mypy.ini` (and other config files):\r\n- Python version used: 3.11\r\n\r\n\u003c!-- You can freely edit this text, please remove all the lines you believe are unnecessary. -->\r\n","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2023-11-04T11:49:46Z","url":"https://github.com/python/mypy/issues/16405"}
| 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:72a8a223-3779-80a9-15da-f3731c8b0aef |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D02E:24D752:4CBFE6:67837F:6B002EBF |
| html-safe-nonce | 11d9c6b5d81214b6d82a92ca9e9a93e9578ac234cde498768fe15d971b6f0d08 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDJFOjI0RDc1Mjo0Q0JGRTY6Njc4MzdGOjZCMDAyRUJGIiwidmlzaXRvcl9pZCI6IjE5NzA4Mjc2NjY3NDc2NzU1MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 41d5a3c32a2246ee063cd328507cd55d2371783cbb38260f0d086e64d2451da2 |
| hovercard-subject-tag | issue:1977298019 |
| 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/16405/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac249d484023fd76ce8956e01b80af0d83e3f8b109f5bb7b764e920e6e0170c7/python/mypy/issues/16405 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac249d484023fd76ce8956e01b80af0d83e3f8b109f5bb7b764e920e6e0170c7/python/mypy/issues/16405 |
| og:image:alt | Bug Report When using ParamSpec and passing a Callable that takes a Callable, mypy 1.6.0, 1.6.1 and master rejects the input, this is a regression from 1.5.1 To Reproduce from typing import * T_Ret... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| 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