Title: Crash on a tricky overloaded Protocol · Issue #17206 · python/mypy · GitHub
Open Graph Title: Crash on a tricky overloaded Protocol · Issue #17206 · python/mypy
X Title: Crash on a tricky overloaded Protocol · Issue #17206 · python/mypy
Description: Crash Report A crash happens while using _W wrapper below, which is a cut down version of functools._Wrapped. Traceback _broken.pyi:13: error: INTERNAL ERROR -- Please try using mypy master on GitHub: https://mypy.readthedocs.io/en/stabl...
Open Graph Description: Crash Report A crash happens while using _W wrapper below, which is a cut down version of functools._Wrapped. Traceback _broken.pyi:13: error: INTERNAL ERROR -- Please try using mypy master on GitH...
X Description: Crash Report A crash happens while using _W wrapper below, which is a cut down version of functools._Wrapped. Traceback _broken.pyi:13: error: INTERNAL ERROR -- Please try using mypy master on GitH...
Opengraph URL: https://github.com/python/mypy/issues/17206
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash on a tricky overloaded Protocol","articleBody":"\u003c!--\r\n Use this form only if mypy reports an \"INTERNAL ERROR\" and/or gives a traceback.\r\n Please include the traceback and all other messages below (use `mypy --show-traceback`).\r\n-->\r\n\r\n**Crash Report**\r\n\r\nA crash happens while using `_W` wrapper below, which is a cut down version of `functools._Wrapped`.\r\n\r\n**Traceback**\r\n\r\n```\r\n_broken.pyi:13: 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.10.0\r\nTraceback (most recent call last):\r\n File \"mypy/checker.py\", line 589, in accept\r\n File \"mypy/nodes.py\", line 586, in accept\r\n File \"mypy/checker.py\", line 626, in visit_overloaded_func_def\r\n File \"mypy/checker.py\", line 656, in _visit_overloaded_func_def\r\n File \"mypy/checker.py\", line 767, in check_overlapping_overloads\r\n File \"mypy/checker.py\", line 7813, in is_unsafe_overlapping_overload_signatures\r\n File \"mypy/subtypes.py\", line 1521, in is_callable_compatible\r\n File \"mypy/subtypes.py\", line 1862, in unify_generic_callable\r\n File \"mypy/constraints.py\", line 311, in infer_constraints\r\n File \"mypy/constraints.py\", line 407, in _infer_constraints\r\n File \"mypy/types.py\", line 1444, in accept\r\n File \"mypy/constraints.py\", line 802, in visit_instance\r\n File \"mypy/constraints.py\", line 314, in infer_constraints\r\n File \"mypy/constraints.py\", line 407, in _infer_constraints\r\n File \"mypy/types.py\", line 1730, in accept\r\n File \"mypy/constraints.py\", line 698, in visit_parameters\r\nRuntimeError: Parameters cannot be constrained to\r\n_broken.pyi:13: : note: use --pdb to drop into pdb\r\n```\r\n\r\n`_broken.pyi`:\r\n\r\n```python\r\nfrom typing import Callable, Generic, ParamSpec, Protocol, TypeVar, overload\r\n\r\n_PD = ParamSpec('_PD')\r\n_PF = ParamSpec('_PF')\r\n_RD = TypeVar('_RD')\r\n_RF = TypeVar('_RF')\r\n\r\n# from functools import _Wrapped as _W\r\nclass _W(Generic[_PF, _RF, _PD, _RD]):\r\n ...\r\n\r\nclass _DecoOrFab(Protocol[_PD, _RD]):\r\n @overload\r\n def __call__(self, f: Callable[_PF, _RF]) -> _W[_PF, _RF, ..., _RD]: ...\r\n @overload\r\n def __call__(self, **kwargs) -> _W[_PD, _RD, ..., ...]: ...\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.10.0\r\n- Mypy command-line flags: `mypy --show-traceback _broken.pyi`\r\n- Mypy configuration options from `mypy.ini` (and other config files):\r\n- Python version used: 3.11.8\r\n- Operating system and version: Linux, 6.6.26-1-MANJARO, x86_64 GNU/Linux\r\n\r\n`mypy.ini`:\r\n\r\n```ini\r\n[mypy]\r\npython_version = 3.11\r\ncheck_untyped_defs = true\r\n; disallow_untyped_calls = true\r\nignore_errors = false\r\nignore_missing_imports = true\r\nwarn_unused_ignores = true\r\nwarn_redundant_casts = true\r\nwarn_unused_configs = true\r\nfollow_imports = silent\r\ndisable_error_code = var-annotated\r\n```\r\n\r\n\u003c!--\r\nYou can freely edit this text, please remove all the lines\r\nyou believe are unnecessary.\r\n-->","author":{"url":"https://github.com/Suor","@type":"Person","name":"Suor"},"datePublished":"2024-05-02T05:26:27Z","url":"https://github.com/python/mypy/issues/17206"}
| 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:d052a480-3713-2e3d-df6c-8037370384ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BC38:BACA4:2C24DA7:3A50761:6B001E17 |
| html-safe-nonce | 9b5c04de200b3560bf00e82d8bb968351854c5333e08967789f6550ec216cb4a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzM4OkJBQ0E0OjJDMjREQTc6M0E1MDc2MTo2QjAwMUUxNyIsInZpc2l0b3JfaWQiOiI4MTQyNDc1MTU1NjE3MDk1MTkxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9e876be75f243ad1cde91353b1533eeaf619e5c23112d197bbda19020f7b9def |
| hovercard-subject-tag | issue:2274638831 |
| 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/17206/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb3a2e716e8b2fbe31a3218261ad48a17ff0c23961ca269b5f84d3f7d42827b5/python/mypy/issues/17206 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb3a2e716e8b2fbe31a3218261ad48a17ff0c23961ca269b5f84d3f7d42827b5/python/mypy/issues/17206 |
| og:image:alt | Crash Report A crash happens while using _W wrapper below, which is a cut down version of functools._Wrapped. Traceback _broken.pyi:13: error: INTERNAL ERROR -- Please try using mypy master on GitH... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Suor |
| 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