Title: Crash when checking for method override · Issue #2372 · python/mypy · GitHub
Open Graph Title: Crash when checking for method override · Issue #2372 · python/mypy
X Title: Crash when checking for method override · Issue #2372 · python/mypy
Description: class A: def f(self): # type: () -> str return 'foo' class B(A): def f(self): # type: () -> str return self.x def initialize(self): # type: () -> None self.x = 'bar' crashes with /Users/ddfisher/test/test.py:7: error: INTERNAL ERROR -- p...
Open Graph Description: class A: def f(self): # type: () -> str return 'foo' class B(A): def f(self): # type: () -> str return self.x def initialize(self): # type: () -> None self.x = 'bar' crashes with /Users/ddfisher/te...
X Description: class A: def f(self): # type: () -> str return 'foo' class B(A): def f(self): # type: () -> str return self.x def initialize(self): # type: () -> None self.x = 'bar' crashe...
Opengraph URL: https://github.com/python/mypy/issues/2372
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash when checking for method override","articleBody":"``` py\nclass A:\n def f(self):\n # type: () -> str\n return 'foo'\n\nclass B(A):\n def f(self):\n # type: () -> str\n return self.x\n\n def initialize(self):\n # type: () -> None\n self.x = 'bar'\n```\n\ncrashes with\n\n```\n/Users/ddfisher/test/test.py:7: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues\nTraceback (most recent call last):\n File \"/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 184, in _run_module_as_main\n \"__main__\", mod_spec)\n File \"/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/Users/ddfisher/src/mypy/mypy/__main__.py\", line 5, in \u003cmodule>\n main(None)\n File \"/Users/ddfisher/src/mypy/mypy/main.py\", line 41, in main\n res = type_check_only(sources, bin_dir, options)\n File \"/Users/ddfisher/src/mypy/mypy/main.py\", line 86, in type_check_only\n options=options)\n File \"/Users/ddfisher/src/mypy/mypy/build.py\", line 180, in build\n dispatch(sources, manager)\n File \"/Users/ddfisher/src/mypy/mypy/build.py\", line 1509, in dispatch\n process_graph(graph, manager)\n File \"/Users/ddfisher/src/mypy/mypy/build.py\", line 1689, in process_graph\n process_stale_scc(graph, scc)\n File \"/Users/ddfisher/src/mypy/mypy/build.py\", line 1773, in process_stale_scc\n if graph[id].type_check_second_pass():\n File \"/Users/ddfisher/src/mypy/mypy/build.py\", line 1443, in type_check_second_pass\n return self.type_checker.check_second_pass()\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 211, in check_second_pass\n self.accept(node)\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 237, in accept\n typ = node.accept(self)\n File \"/Users/ddfisher/src/mypy/mypy/nodes.py\", line 531, in accept\n return visitor.visit_func_def(self)\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 451, in visit_func_def\n self.check_method_override(defn)\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 852, in check_method_override\n self.check_method_or_accessor_override_for_base(defn, base)\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 861, in check_method_or_accessor_override_for_base\n self.check_method_override_for_base_with_name(defn, name, base)\n File \"/Users/ddfisher/src/mypy/mypy/checker.py\", line 879, in check_method_override_for_base_with_name\n typ = bind_self(self.function_type(defn), self.class_context[-1])\nIndexError: list index out of range\n```\n\n@elazarg @JukkaL I think this is also related to #2193.\n","author":{"url":"https://github.com/ddfisher","@type":"Person","name":"ddfisher"},"datePublished":"2016-10-28T20:12:10Z","url":"https://github.com/python/mypy/issues/2372"}
| 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:9082b223-581e-2a96-7cc2-d267d2aa96f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C93A:2F0104:FBBCDD:14A8587:6B00053E |
| html-safe-nonce | 7789cc42e7f35604669d4084bd22a7c3a7224442e4de2ea094c4aa852585dabb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOTNBOjJGMDEwNDpGQkJDREQ6MTRBODU4Nzo2QjAwMDUzRSIsInZpc2l0b3JfaWQiOiI5MTAyMjMzMTE3NDI2NDUxNzc0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b5ca04e397eb4926ae1edb314d9582e63360ff4538fea04ae4262b02b6a333c7 |
| hovercard-subject-tag | issue:186011086 |
| 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/2372/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e505984de08cd0886c9cd2c32eda803ea953bffa4fea9a08db66eb7684398ea8/python/mypy/issues/2372 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e505984de08cd0886c9cd2c32eda803ea953bffa4fea9a08db66eb7684398ea8/python/mypy/issues/2372 |
| og:image:alt | class A: def f(self): # type: () -> str return 'foo' class B(A): def f(self): # type: () -> str return self.x def initialize(self): # type: () -> None self.x = 'bar' crashes with /Users/ddfisher/te... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ddfisher |
| 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