Title: Crash with star imports and new file in the build · Issue #6110 · python/mypy · GitHub
Open Graph Title: Crash with star imports and new file in the build · Issue #6110 · python/mypy
X Title: Crash with star imports and new file in the build · Issue #6110 · python/mypy
Description: This test case: [case testAddedSubStar] # cmd: mypy -m a pack pack.mod b # cmd2: mypy -m other [file a.py] from pack import * [file pack/__init__.py] [file pack/mod.py] [file b.py] import pack.mod [file other.py] import a [out] [out2] cr...
Open Graph Description: This test case: [case testAddedSubStar] # cmd: mypy -m a pack pack.mod b # cmd2: mypy -m other [file a.py] from pack import * [file pack/__init__.py] [file pack/mod.py] [file b.py] import pack.mod ...
X Description: This test case: [case testAddedSubStar] # cmd: mypy -m a pack pack.mod b # cmd2: mypy -m other [file a.py] from pack import * [file pack/__init__.py] [file pack/mod.py] [file b.py] import pack.mod ...
Opengraph URL: https://github.com/python/mypy/issues/6110
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Crash with star imports and new file in the build","articleBody":"This test case:\r\n```\r\n[case testAddedSubStar]\r\n# cmd: mypy -m a pack pack.mod b\r\n# cmd2: mypy -m other\r\n[file a.py]\r\nfrom pack import *\r\n[file pack/__init__.py]\r\n[file pack/mod.py]\r\n[file b.py]\r\nimport pack.mod\r\n[file other.py]\r\nimport a\r\n[out]\r\n[out2]\r\n```\r\ncrashes with\r\n```\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:157: in build\r\n result = _build(sources, options, alt_lib_path, flush_errors, fscache)\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:207: in _build\r\n graph = dispatch(sources, manager)\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:2214: in dispatch\r\n process_graph(graph, manager)\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:2505: in process_graph\r\n process_fresh_modules(graph, prev_scc, manager)\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:2591: in process_fresh_modules\r\n graph[id].fix_cross_refs()\r\n/Users/ilevkivskyi/src/mypy/mypy/build.py:1598: in fix_cross_refs\r\n self.options.use_fine_grained_cache)\r\n/Users/ilevkivskyi/src/mypy/mypy/fixup.py:25: in fixup_module\r\n node_fixer.visit_symbol_table(tree.names)\r\n/Users/ilevkivskyi/src/mypy/mypy/fixup.py:77: in visit_symbol_table\r\n self.quick_and_dirty)\r\n/Users/ilevkivskyi/src/mypy/mypy/fixup.py:261: in lookup_qualified_stnode\r\n return lookup_fully_qualified(name, modules, raise_on_missing=not quick_and_dirty)\r\n/Users/ilevkivskyi/src/mypy/mypy/lookup.py:47: in lookup_fully_qualified\r\n assert key in names, \"Cannot find %s for %s\" % (key, name)\r\nAssertionError: Cannot find mod for pack.mod\r\n```\r\nI think this is high priority because the crash affects users who adds new files to typed builds in existing code bases. There must be another way to reproduce this where all files from first command are also present in the second, but I didn't find a simple version of it.\r\n\r\nAnyway, the crux seems to be the interference between lack of dependencies from star import (that can also import modules), and `add_submodules_to_parent_modules()`.","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2018-12-27T19:58:38Z","url":"https://github.com/python/mypy/issues/6110"}
| 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:3ed07613-f6ec-502f-86e1-7843356ce68a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBB4:102136:2C45BD:3B63CF:6B0025C7 |
| html-safe-nonce | d6d1ec7c9c3b611572a78c269874ea04ef3543ab62cc8b09cdd4614c60882640 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkI0OjEwMjEzNjoyQzQ1QkQ6M0I2M0NGOjZCMDAyNUM3IiwidmlzaXRvcl9pZCI6IjY5MjUxNTI4MzI2MDk4NTQ5MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 676b72e4f9d53f2440198b3c55ac645d2b56efc3f8cc67009dfcf82e9717ab56 |
| hovercard-subject-tag | issue:394476816 |
| 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/6110/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6a145f2e326efc4957613d4eb244b2bbb89985330bc0c9f0bc059b931716ca05/python/mypy/issues/6110 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6a145f2e326efc4957613d4eb244b2bbb89985330bc0c9f0bc059b931716ca05/python/mypy/issues/6110 |
| og:image:alt | This test case: [case testAddedSubStar] # cmd: mypy -m a pack pack.mod b # cmd2: mypy -m other [file a.py] from pack import * [file pack/__init__.py] [file pack/mod.py] [file b.py] import pack.mod ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width