Title: Internal Error when overriding a generic variable in __init__ · Issue #5846 · python/mypy · GitHub
Open Graph Title: Internal Error when overriding a generic variable in __init__ · Issue #5846 · python/mypy
X Title: Internal Error when overriding a generic variable in __init__ · Issue #5846 · python/mypy
Description: This is a bug report. I created a simple python file called breakmypy.py which has the following contents: # contents of breakmypy.py from collections import UserDict class MyDict(UserDict): def __init__(self): self.data: dict = {} When ...
Open Graph Description: This is a bug report. I created a simple python file called breakmypy.py which has the following contents: # contents of breakmypy.py from collections import UserDict class MyDict(UserDict): def __...
X Description: This is a bug report. I created a simple python file called breakmypy.py which has the following contents: # contents of breakmypy.py from collections import UserDict class MyDict(UserDict): def __...
Opengraph URL: https://github.com/python/mypy/issues/5846
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Internal Error when overriding a generic variable in __init__","articleBody":"This is a bug report.\r\n\r\nI created a simple python file called breakmypy.py which has the following contents:\r\n\r\n```python\r\n# contents of breakmypy.py\r\nfrom collections import UserDict\r\n\r\nclass MyDict(UserDict):\r\n def __init__(self):\r\n self.data: dict = {}\r\n```\r\n\r\nWhen I run `mypy breakmypy.py --show-traceback` the following output is emitted:\r\n\r\nbreakmypy.py:14: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.630\r\n```python\r\nTraceback (most recent call last):\r\n File \"/home/derrick_chambers/anaconda3/bin/mypy\", line 11, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/__main__.py\", line 7, in console_entry\r\n main(None)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/main.py\", line 91, in main\r\n res = type_check_only(sources, bin_dir, options, flush_errors, fscache) # noqa\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/main.py\", line 148, in type_check_only\r\n fscache=fscache)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 183, in build\r\n flush_errors, fscache)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 356, in _build\r\n graph = dispatch(sources, manager)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 2543, in dispatch\r\n process_graph(graph, manager)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 2840, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 2963, in process_stale_scc\r\n graph[id].type_check_first_pass()\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/build.py\", line 2103, in type_check_first_pass\r\n self.type_checker().check_first_pass()\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 256, in check_first_pass\r\n self.accept(d)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 355, in accept\r\n stmt.accept(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/nodes.py\", line 820, in accept\r\n return visitor.visit_class_def(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1461, in visit_class_def\r\n self.accept(defn.defs)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 355, in accept\r\n stmt.accept(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/nodes.py\", line 885, in accept\r\n return visitor.visit_block(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1607, in visit_block\r\n self.accept(s)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 355, in accept\r\n stmt.accept(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/nodes.py\", line 603, in accept\r\n return visitor.visit_func_def(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 666, in visit_func_def\r\n self._visit_func_def(defn)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 670, in _visit_func_def\r\n self.check_func_item(defn, name=defn.name())\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 732, in check_func_item\r\n self.check_func_def(defn, typ, name)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 898, in check_func_def\r\n self.accept(item.body)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 355, in accept\r\n stmt.accept(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/nodes.py\", line 885, in accept\r\n return visitor.visit_block(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1607, in visit_block\r\n self.accept(s)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 355, in accept\r\n stmt.accept(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/nodes.py\", line 933, in accept\r\n return visitor.visit_assignment_stmt(self)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1614, in visit_assignment_stmt\r\n self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1663, in check_assignment\r\n if self.check_compatibility_all_supers(lvalue, lvalue_type, rvalue):\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1755, in check_compatibility_all_supers\r\n base_type, base_node = self.lvalue_type_from_base(lvalue_node, base)\r\n File \"/home/derrick_chambers/anaconda3/lib/python3.7/site-packages/mypy/checker.py\", line 1842, in lvalue_type_from_base\r\n assert self_type is not None, \"Internal error: base lookup outside class\"\r\nAssertionError: Internal error: base lookup outside class\r\nbreakmypy.py:14: : note: use --pdb to drop into pdb\r\n```\r\n","author":{"url":"https://github.com/d-chambers","@type":"Person","name":"d-chambers"},"datePublished":"2018-10-27T04:22:06Z","url":"https://github.com/python/mypy/issues/5846"}
| 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:43da4d51-2a32-6116-748f-31cd6b231dae |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A214:1BAA33:128BCE8:1868D86:6B000571 |
| html-safe-nonce | 39a1e31d92480904199b0f4ce036d8621320d53f7df946e42c21524f86c3f892 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjE0OjFCQUEzMzoxMjhCQ0U4OjE4NjhEODY6NkIwMDA1NzEiLCJ2aXNpdG9yX2lkIjoiMjk4NTM4ODAwNzgyMjk4NDU2MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2a29d6a5b5beb42b90f7306db00dc29c6579db62d0b2f8518830ccfccdcb51a6 |
| hovercard-subject-tag | issue:374604647 |
| 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/5846/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2b3725fded42a39e08f721bf080a0f38b4c46ac7ae02048c2194eeef7f7c379e/python/mypy/issues/5846 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2b3725fded42a39e08f721bf080a0f38b4c46ac7ae02048c2194eeef7f7c379e/python/mypy/issues/5846 |
| og:image:alt | This is a bug report. I created a simple python file called breakmypy.py which has the following contents: # contents of breakmypy.py from collections import UserDict class MyDict(UserDict): def __... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | d-chambers |
| 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