Title: Crash when serializing property with forward reference · Issue #4682 · python/mypy · GitHub
Open Graph Title: Crash when serializing property with forward reference · Issue #4682 · python/mypy
X Title: Crash when serializing property with forward reference · Issue #4682 · python/mypy
Description: This serialization test case fails with a crash: [case testSerializeForwardReferenceToAliasInProperty] import a [file a.py] import b [file a.py.2] import b reveal_type(b.A().p) [file b.py] class A: @property def p(self) -> C: pass @p.set...
Open Graph Description: This serialization test case fails with a crash: [case testSerializeForwardReferenceToAliasInProperty] import a [file a.py] import b [file a.py.2] import b reveal_type(b.A().p) [file b.py] class A:...
X Description: This serialization test case fails with a crash: [case testSerializeForwardReferenceToAliasInProperty] import a [file a.py] import b [file a.py.2] import b reveal_type(b.A().p) [file b.py] class A:...
Opengraph URL: https://github.com/python/mypy/issues/4682
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash when serializing property with forward reference","articleBody":"This serialization test case fails with a crash:\r\n\r\n```\r\n[case testSerializeForwardReferenceToAliasInProperty]\r\nimport a\r\n[file a.py]\r\nimport b\r\n[file a.py.2]\r\nimport b\r\nreveal_type(b.A().p)\r\n[file b.py]\r\n\r\nclass A:\r\n @property\r\n def p(self) -> C: pass\r\n @p.setter\r\n def p(self, c: C) -> None: pass\r\n @p.deleter\r\n def p(self) -> None: pass\r\n\r\nC = str\r\n[builtins fixtures/property.pyi]\r\n```\r\n\r\nHere's the traceback:\r\n\r\n```\r\n/Users/jukka/src/mypy/mypy/test/testcheck.py:105: in run_case\r\n self.run_case_once(testcase, step)\r\n/Users/jukka/src/mypy/mypy/test/testcheck.py:169: in run_case_once\r\n alt_lib_path=test_temp_dir)\r\n/Users/jukka/src/mypy/mypy/build.py:180: in build\r\n result = _build(sources, options, alt_lib_path, bin_dir, saved_cache, flush_errors)\r\n/Users/jukka/src/mypy/mypy/build.py:266: in _build\r\n graph = dispatch(sources, manager)\r\n/Users/jukka/src/mypy/mypy/build.py:2114: in dispatch\r\n process_graph(graph, manager)\r\n/Users/jukka/src/mypy/mypy/build.py:2421: in process_graph\r\n process_stale_scc(graph, scc, manager)\r\n/Users/jukka/src/mypy/mypy/build.py:2621: in process_stale_scc\r\n graph[id].write_cache()\r\n/Users/jukka/src/mypy/mypy/build.py:2071: in write_cache\r\n self.manager)\r\n/Users/jukka/src/mypy/mypy/build.py:1260: in write_cache\r\n data = {'tree': tree.serialize(),\r\n/Users/jukka/src/mypy/mypy/nodes.py:247: in serialize\r\n 'names': self.names.serialize(self._fullname),\r\n/Users/jukka/src/mypy/mypy/nodes.py:2521: in serialize\r\n data[key] = value.serialize(fullname, key)\r\n/Users/jukka/src/mypy/mypy/nodes.py:2456: in serialize\r\n data['node'] = self.node.serialize()\r\n/Users/jukka/src/mypy/mypy/nodes.py:2229: in serialize\r\n 'names': self.names.serialize(self.fullname()),\r\n/Users/jukka/src/mypy/mypy/nodes.py:2521: in serialize\r\n data[key] = value.serialize(fullname, key)\r\n/Users/jukka/src/mypy/mypy/nodes.py:2458: in serialize\r\n data['type_override'] = self.type_override.serialize()\r\n/Users/jukka/src/mypy/mypy/types.py:955: in serialize\r\n 'items': [t.serialize() for t in self.items()],\r\n/Users/jukka/src/mypy/mypy/types.py:955: in \u003clistcomp>\r\n 'items': [t.serialize() for t in self.items()],\r\n/Users/jukka/src/mypy/mypy/types.py:870: in serialize\r\n 'ret_type': self.ret_type.serialize(),\r\n/Users/jukka/src/mypy/mypy/types.py:1429: in serialize\r\n assert False, \"Internal error: Unresolved forward reference to {}\".format(name)\r\nE AssertionError: Internal error: Unresolved forward reference to C\r\n```\r\n\r\nIt looks like we don't remove forward references in the `type_override` attribute of symbol table nodes.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2018-03-06T11:52:59Z","url":"https://github.com/python/mypy/issues/4682"}
| 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:67034203-145b-9e4d-f649-19b7c1057803 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EA7A:1A12A9:A78AB8:DEFCA6:6B004836 |
| html-safe-nonce | db024a8a760943cca472504eda118d37efbd196e3e238c4ac86e023d74ac75ac |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTdBOjFBMTJBOTpBNzhBQjg6REVGQ0E2OjZCMDA0ODM2IiwidmlzaXRvcl9pZCI6IjExMDMzNjIyMzUyNTU3NjkxNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ccfcf2a93fbc6d6ab1f17c849ca8685b9bef52cf365668927464067a81962299 |
| hovercard-subject-tag | issue:302671293 |
| 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/4682/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6fd8d5b34e9f809d4cad56d2b064b3caf757f5fbffbd009c5f76be0e1abe4a5e/python/mypy/issues/4682 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6fd8d5b34e9f809d4cad56d2b064b3caf757f5fbffbd009c5f76be0e1abe4a5e/python/mypy/issues/4682 |
| og:image:alt | This serialization test case fails with a crash: [case testSerializeForwardReferenceToAliasInProperty] import a [file a.py] import b [file a.py.2] import b reveal_type(b.A().p) [file b.py] class A:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| 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