Title: INTERNAL ERROR when using `:=` assignment expression · Issue #9054 · python/mypy · GitHub
Open Graph Title: INTERNAL ERROR when using `:=` assignment expression · Issue #9054 · python/mypy
X Title: INTERNAL ERROR when using `:=` assignment expression · Issue #9054 · python/mypy
Description: To reproduce the bug, run mypy with the following command: mypy --show-traceback test.py Where the contents of test.py are: def func() -> None: obj = MyClass() if result := obj.var_name: pass class MyClass: def __init__(self): self.var_n...
Open Graph Description: To reproduce the bug, run mypy with the following command: mypy --show-traceback test.py Where the contents of test.py are: def func() -> None: obj = MyClass() if result := obj.var_name: pass class...
X Description: To reproduce the bug, run mypy with the following command: mypy --show-traceback test.py Where the contents of test.py are: def func() -> None: obj = MyClass() if result := obj.var_name: pass cl...
Opengraph URL: https://github.com/python/mypy/issues/9054
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"INTERNAL ERROR when using `:=` assignment expression","articleBody":"To reproduce the bug, run `mypy` with the following command:\r\n```bash\r\nmypy --show-traceback test.py\r\n```\r\n\r\nWhere the contents of `test.py` are:\r\n\r\n```python\r\ndef func() -> None:\r\n obj = MyClass()\r\n if result := obj.var_name:\r\n pass\r\n\r\n\r\nclass MyClass:\r\n def __init__(self):\r\n self.var_name = \"abc\"\r\n```\r\n\r\nHere is the traceback that I get:\r\n\r\n```\r\ntest.py:3: 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.790+dev.6ee562a8f3e69ac134f8c501b79b3712c9e24bbd\r\nTraceback (most recent call last):\r\n File \"***/bin/mypy\", line 8, in \u003cmodule>\r\n sys.exit(console_entry())\r\n File \"***/python3.8/site-packages/mypy/__main__.py\", line 8, in console_entry\r\n main(None, sys.stdout, sys.stderr)\r\n File \"***/python3.8/site-packages/mypy/main.py\", line 89, in main\r\n res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 180, in build\r\n result = _build(\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 252, in _build\r\n graph = dispatch(sources, manager, stdout)\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 2626, in dispatch\r\n process_graph(graph, manager)\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 2949, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 3047, in process_stale_scc\r\n graph[id].type_check_first_pass()\r\n File \"***/python3.8/site-packages/mypy/build.py\", line 2107, in type_check_first_pass\r\n self.type_checker().check_first_pass()\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 294, in check_first_pass\r\n self.accept(d)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 401, in accept\r\n stmt.accept(self)\r\n File \"***/python3.8/site-packages/mypy/nodes.py\", line 677, in accept\r\n return visitor.visit_func_def(self)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 726, in visit_func_def\r\n self._visit_func_def(defn)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 730, in _visit_func_def\r\n self.check_func_item(defn, name=defn.name)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 792, in check_func_item\r\n self.check_func_def(defn, typ, name)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 975, in check_func_def\r\n self.accept(item.body)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 401, in accept\r\n stmt.accept(self)\r\n File \"***/python3.8/site-packages/mypy/nodes.py\", line 1005, in accept\r\n return visitor.visit_block(self)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 1973, in visit_block\r\n self.accept(s)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 401, in accept\r\n stmt.accept(self)\r\n File \"***/python3.8/site-packages/mypy/nodes.py\", line 1196, in accept\r\n return visitor.visit_if_stmt(self)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 3212, in visit_if_stmt\r\n if_map, else_map = self.find_isinstance_check(e)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 3928, in find_isinstance_check\r\n if_map, else_map = self.find_isinstance_check_helper(node)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 4104, in find_isinstance_check_helper\r\n return self.find_isinstance_check_helper(node.target)\r\n File \"***/python3.8/site-packages/mypy/checker.py\", line 4108, in find_isinstance_check_helper\r\n vartype = type_map[node]\r\nKeyError: \u003cmypy.nodes.NameExpr object at 0x7fb2f0768940>\r\ntest.py:3: : note: use --pdb to drop into pdb\r\n```\r\n\r\n\r\nmypy 0.790+dev.6ee562a8f3e69ac134f8c501b79b3712c9e24bbd\r\nPython 3.8.2\r\n","author":{"url":"https://github.com/Apakottur","@type":"Person","name":"Apakottur"},"datePublished":"2020-06-26T13:33:30Z","url":"https://github.com/python/mypy/issues/9054"}
| 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:c92cd3b6-ee81-a1bf-78af-4816d2c44e80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED2A:15E5F9:293F672:38656AD:6B005076 |
| html-safe-nonce | 0a25518af84ceaa9296de63811a69d2863649bc5efe3cb36c6c504f428f6ec24 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDJBOjE1RTVGOToyOTNGNjcyOjM4NjU2QUQ6NkIwMDUwNzYiLCJ2aXNpdG9yX2lkIjoiNDY2MzYyMzg4MjkxMjA1OTUxMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a730afd9acae80e465d94e0a3beb1dceb5d4bb2e46a037b669a319afca92702e |
| hovercard-subject-tag | issue:646267100 |
| 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/9054/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0bafb16d192e0e685c6f33186d87fb166dd46f0515a9de07832401feceeb4292/python/mypy/issues/9054 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0bafb16d192e0e685c6f33186d87fb166dd46f0515a9de07832401feceeb4292/python/mypy/issues/9054 |
| og:image:alt | To reproduce the bug, run mypy with the following command: mypy --show-traceback test.py Where the contents of test.py are: def func() -> None: obj = MyClass() if result := obj.var_name: pass class... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Apakottur |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width