Title: Crash when overriding field as property/method on frozen derived class · Issue #8334 · python/mypy · GitHub
Open Graph Title: Crash when overriding field as property/method on frozen derived class · Issue #8334 · python/mypy
X Title: Crash when overriding field as property/method on frozen derived class · Issue #8334 · python/mypy
Description: I see this on python/mypy master (41b40aa) and Python 3.7.5. Following on from #7535 (fixed recently by @msullivan), this triggers another crash (really just adding the frozen=True from my example on that bug report, though I also droppe...
Open Graph Description: I see this on python/mypy master (41b40aa) and Python 3.7.5. Following on from #7535 (fixed recently by @msullivan), this triggers another crash (really just adding the frozen=True from my example ...
X Description: I see this on python/mypy master (41b40aa) and Python 3.7.5. Following on from #7535 (fixed recently by @msullivan), this triggers another crash (really just adding the frozen=True from my example ...
Opengraph URL: https://github.com/python/mypy/issues/8334
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash when overriding field as property/method on frozen derived class","articleBody":"I see this on python/mypy master (41b40aa4f) and Python 3.7.5.\r\n\r\nFollowing on from #7535 (fixed recently by @msullivan), this triggers another crash (really just adding the `frozen=True` from my example on that bug report, though I also dropped the args to `field` since I realised I could):\r\n\r\n```\r\nfrom dataclasses import dataclass, field\r\n\r\n@dataclass\r\nclass Base:\r\n foo: bool = field()\r\n\r\n@dataclass(frozen=True)\r\nclass Derived(Base):\r\n @property\r\n def foo(self):\r\n pass\r\n```\r\n\r\nTraceback (seems slightly different from #6715 -- the assertion here is in method _freeze, not method collect_attributes):\r\n\r\n```\r\n$ mypy --show-traceback /home/me/minimal3.py\r\n/home/me/minimal3.py:10: 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.41b40aa4fc7cdeb32f5ee4fec97f5379ebbe795d\r\nTraceback (most recent call last):\r\n File \"/home/me/env/3/moving-target/bin/mypy\", line 11, in \u003cmodule>\r\n load_entry_point('mypy', 'console_scripts', 'mypy')()\r\n File \"/home/me/dev/mypy/mypy/__main__.py\", line 8, in console_entry\r\n main(None, sys.stdout, sys.stderr)\r\n File \"/home/me/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 \"/home/me/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 \"/home/me/dev/mypy/mypy/build.py\", line 234, in _build\r\n graph = dispatch(sources, manager, stdout)\r\n File \"/home/me/dev/mypy/mypy/build.py\", line 2631, in dispatch\r\n process_graph(graph, manager)\r\n File \"/home/me/dev/mypy/mypy/build.py\", line 2938, in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n File \"/home/me/dev/mypy/mypy/build.py\", line 3031, in process_stale_scc\r\n mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)\r\n File \"/home/me/dev/mypy/mypy/semanal_main.py\", line 77, in semantic_analysis_for_scc\r\n process_top_levels(graph, scc, patches)\r\n File \"/home/me/dev/mypy/mypy/semanal_main.py\", line 202, in process_top_levels\r\n patches)\r\n File \"/home/me/dev/mypy/mypy/semanal_main.py\", line 330, in semantic_analyze_target\r\n active_type=active_type)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 363, in refresh_partial\r\n self.refresh_top_level(node)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 374, in refresh_top_level\r\n self.accept(d)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 4682, in accept\r\n node.accept(self)\r\n File \"/home/me/dev/mypy/mypy/nodes.py\", line 939, in accept\r\n return visitor.visit_class_def(self)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 1014, in visit_class_def\r\n self.analyze_class(defn)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 1091, in analyze_class\r\n self.analyze_class_body_common(defn)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 1100, in analyze_class_body_common\r\n self.apply_class_plugin_hooks(defn)\r\n File \"/home/me/dev/mypy/mypy/semanal.py\", line 1146, in apply_class_plugin_hooks\r\n hook(ClassDefContext(defn, decorator, self))\r\n File \"/home/me/dev/mypy/mypy/plugins/dataclasses.py\", line 369, in dataclass_class_maker_callback\r\n transformer.transform()\r\n File \"/home/me/dev/mypy/mypy/plugins/dataclasses.py\", line 182, in transform\r\n self._freeze(attributes)\r\n File \"/home/me/dev/mypy/mypy/plugins/dataclasses.py\", line 355, in _freeze\r\n assert isinstance(var, Var)\r\nAssertionError: \r\n/home/me/minimal3.py:10: : note: use --pdb to drop into pdb\r\n```\r\n","author":{"url":"https://github.com/jjlee","@type":"Person","name":"jjlee"},"datePublished":"2020-01-26T14:42:08Z","url":"https://github.com/python/mypy/issues/8334"}
| 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:4c57aa4c-3660-b217-dc83-43a7befa30f3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B848:1F7A:144EC02:1BE74F3:6B002962 |
| html-safe-nonce | c4779566cf10203b69d8bdfee175bca53f2d51c66365517fdf54faf8cfde65fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODQ4OjFGN0E6MTQ0RUMwMjoxQkU3NEYzOjZCMDAyOTYyIiwidmlzaXRvcl9pZCI6IjUxNjk2NDkxMjkwNDI4NDUxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d5c1138242b1df2134304494cbb93035c6f6d6d1e1a633a9f24db7219af7c1b0 |
| hovercard-subject-tag | issue:555237894 |
| 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/8334/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cf6d5918f98e1fb6b0ad8f0a099a462f181dd8ace1688e395504a3c4c24f3bdf/python/mypy/issues/8334 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cf6d5918f98e1fb6b0ad8f0a099a462f181dd8ace1688e395504a3c4c24f3bdf/python/mypy/issues/8334 |
| og:image:alt | I see this on python/mypy master (41b40aa) and Python 3.7.5. Following on from #7535 (fixed recently by @msullivan), this triggers another crash (really just adding the frozen=True from my example ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jjlee |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width