Title: mypy crashes with overloads of functools.singledispatch · Issue #8356 · python/mypy · GitHub
Open Graph Title: mypy crashes with overloads of functools.singledispatch · Issue #8356 · python/mypy
X Title: mypy crashes with overloads of functools.singledispatch · Issue #8356 · python/mypy
Description: I was trying out the advice I gave in #8354, and encountered a mypy crash: ~/delete λ cat test22.py 2 from typing import * import functools @overload def foo(val: str) -> str: ... @overload def foo(val: int) -> int: ... @functools.single...
Open Graph Description: I was trying out the advice I gave in #8354, and encountered a mypy crash: ~/delete λ cat test22.py 2 from typing import * import functools @overload def foo(val: str) -> str: ... @overload def foo...
X Description: I was trying out the advice I gave in #8354, and encountered a mypy crash: ~/delete λ cat test22.py 2 from typing import * import functools @overload def foo(val: str) -> str: ... @overload def ...
Opengraph URL: https://github.com/python/mypy/issues/8356
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy crashes with overloads of functools.singledispatch","articleBody":"I was trying out the advice I gave in https://github.com/python/mypy/issues/8354, and encountered a mypy crash:\r\n\r\n```\r\n~/delete λ cat test22.py 2 \r\nfrom typing import *\r\nimport functools\r\n\r\n\r\n@overload\r\ndef foo(val: str) -> str: ...\r\n@overload\r\ndef foo(val: int) -> int: ...\r\n\r\n\r\n@functools.singledispatch\r\ndef foo(x):\r\n return x\r\n\r\n\r\n@foo.register\r\ndef _(x: int) -> int:\r\n return x + 1\r\n~/delete λ mypy test22.py --show-traceback\r\ntest22.py:5: error: INTERNAL ERROR -- Please try using mypy master on Github:\r\nhttps://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build\r\nPlease report a bug at https://github.com/python/mypy/issues\r\nversion: 0.770+dev.0b9089e9c9be2ad0b345b1d3743f808365d4aefc\r\nTraceback (most recent call last):\r\n File \"/usr/local/bin/mypy\", line 11, in \u003cmodule>\r\n load_entry_point('mypy', 'console_scripts', 'mypy')()\r\n File \"/Users/shantanu/dev/mypy/mypy/__main__.py\", line 8, in console_entry\r\n main(None, sys.stdout, sys.stderr)\r\n File \"/Users/shantanu/dev/mypy/mypy/main.py\", line 89, in main\r\n res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 166, in build\r\n sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr, extra_plugins\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 234, in _build\r\n graph = dispatch(sources, manager, stdout)\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 2612, in dispatch\r\n process_graph(graph, manager)\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 2919, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 3018, in process_stale_scc\r\n graph[id].type_check_first_pass()\r\n File \"/Users/shantanu/dev/mypy/mypy/build.py\", line 2111, in type_check_first_pass\r\n self.type_checker().check_first_pass()\r\n File \"/Users/shantanu/dev/mypy/mypy/checker.py\", line 293, in check_first_pass\r\n self.accept(d)\r\n File \"/Users/shantanu/dev/mypy/mypy/checker.py\", line 400, in accept\r\n stmt.accept(self)\r\n File \"/Users/shantanu/dev/mypy/mypy/nodes.py\", line 515, in accept\r\n return visitor.visit_overloaded_func_def(self)\r\n File \"/Users/shantanu/dev/mypy/mypy/checker.py\", line 433, in visit_overloaded_func_def\r\n self._visit_overloaded_func_def(defn)\r\n File \"/Users/shantanu/dev/mypy/mypy/checker.py\", line 460, in _visit_overloaded_func_def\r\n self.check_overlapping_overloads(defn)\r\n File \"/Users/shantanu/dev/mypy/mypy/checker.py\", line 481, in check_overlapping_overloads\r\n assert isinstance(inner_type, CallableType)\r\nAssertionError: \r\ntest22.py:5: : note: use --pdb to drop into pdb\r\n```","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2020-02-02T08:35:39Z","url":"https://github.com/python/mypy/issues/8356"}
| 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:ca0587a4-2c81-547f-d07e-fda8570310d9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9D8:23FDF9:2054D8A:2C0FCA2:6B00240B |
| html-safe-nonce | 4b672e4a0a75570437102c8eae53efc122c999228a81d7ae007f0986ea2600a1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUQ4OjIzRkRGOToyMDU0RDhBOjJDMEZDQTI6NkIwMDI0MEIiLCJ2aXNpdG9yX2lkIjoiMzA1MzA3NDMxNzI5MTAzNzcwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a723d9be318d16f614d9b7dc0549aea25721c3f2ecaa0a6850fbdc04129165df |
| hovercard-subject-tag | issue:558663686 |
| 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/8356/issue_layout |
| twitter:image | https://opengraph.githubassets.com/87221ec637f1dcf7e6548dd22a56f6fbdaeb6decdac03ccdeaf299ee1c05729a/python/mypy/issues/8356 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/87221ec637f1dcf7e6548dd22a56f6fbdaeb6decdac03ccdeaf299ee1c05729a/python/mypy/issues/8356 |
| og:image:alt | I was trying out the advice I gave in #8354, and encountered a mypy crash: ~/delete λ cat test22.py 2 from typing import * import functools @overload def foo(val: str) -> str: ... @overload def foo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hauntsaninja |
| 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