Title: dmypy: ValueError: value is not in list when running a second time · Issue #12744 · python/mypy · GitHub
Open Graph Title: dmypy: ValueError: value is not in list when running a second time · Issue #12744 · python/mypy
X Title: dmypy: ValueError: value is not in list when running a second time · Issue #12744 · python/mypy
Description: I've had problems with this situation on and off for many weeks now, with 0.941 and now 0.950. sometimes it isn't happening at all, and other times, like at the moment, I get this stack trace reliably on any second run of dympy. Typicall...
Open Graph Description: I've had problems with this situation on and off for many weeks now, with 0.941 and now 0.950. sometimes it isn't happening at all, and other times, like at the moment, I get this stack trace relia...
X Description: I've had problems with this situation on and off for many weeks now, with 0.941 and now 0.950. sometimes it isn't happening at all, and other times, like at the moment, I get this stack tra...
Opengraph URL: https://github.com/python/mypy/issues/12744
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"dmypy: ValueError: value is not in list when running a second time","articleBody":"I've had problems with this situation on and off for many weeks now, with 0.941 and now 0.950. sometimes it isn't happening at all, and other times, like at the moment, I get this stack trace reliably on any second run of dympy. Typically, once I get the files I'm typing in better shape, the error goes away. But to get there my process is greatly slowed by dmypy crashing on every non-initial run making it mostly not useful compared to running plain mypy.\r\n\r\nreproduction steps follow below. the crash is:\r\n\r\n\r\n```py\r\n$ dmypy check lib\r\nDaemon crashed!\r\nTraceback (most recent call last):\r\n File \"mypy/dmypy_server.py\", line 230, in serve\r\n File \"mypy/dmypy_server.py\", line 273, in run_command\r\n File \"mypy/dmypy_server.py\", line 341, in cmd_check\r\n File \"mypy/dmypy_server.py\", line 394, in check\r\n File \"mypy/dmypy_server.py\", line 569, in fine_grained_increment_follow_imports\r\n File \"mypy/server/update.py\", line 245, in update\r\n File \"mypy/server/update.py\", line 328, in update_one\r\n File \"mypy/server/update.py\", line 393, in update_module\r\n File \"mypy/server/update.py\", line 615, in update_module_isolated\r\n File \"mypy/build.py\", line 2192, in type_check_first_pass\r\n File \"mypy/checker.py\", line 319, in check_first_pass\r\n File \"mypy/checker.py\", line 427, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checker.py\", line 425, in accept\r\n File \"mypy/nodes.py\", line 1021, in accept\r\n File \"mypy/checker.py\", line 1810, in visit_class_def\r\n File \"mypy/checker.py\", line 427, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checker.py\", line 425, in accept\r\n File \"mypy/nodes.py\", line 1092, in accept\r\n File \"mypy/checker.py\", line 2174, in visit_block\r\n File \"mypy/checker.py\", line 427, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checker.py\", line 425, in accept\r\n File \"mypy/nodes.py\", line 740, in accept\r\n File \"mypy/checker.py\", line 776, in visit_func_def\r\n File \"mypy/checker.py\", line 780, in _visit_func_def\r\n File \"mypy/checker.py\", line 842, in check_func_item\r\n File \"mypy/checker.py\", line 1027, in check_func_def\r\n File \"mypy/checker.py\", line 427, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checker.py\", line 425, in accept\r\n File \"mypy/nodes.py\", line 1092, in accept\r\n File \"mypy/checker.py\", line 2174, in visit_block\r\n File \"mypy/checker.py\", line 427, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checker.py\", line 425, in accept\r\n File \"mypy/nodes.py\", line 1316, in accept\r\n File \"mypy/checker.py\", line 3581, in visit_if_stmt\r\n File \"mypy/checkexpr.py\", line 3983, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checkexpr.py\", line 3981, in accept\r\n File \"mypy/nodes.py\", line 1897, in accept\r\n File \"mypy/checkexpr.py\", line 2244, in visit_comparison_expr\r\n File \"mypy/checkexpr.py\", line 3983, in accept\r\n File \"mypy/errors.py\", line 902, in report_internal_error\r\n File \"mypy/checkexpr.py\", line 3981, in accept\r\n File \"mypy/nodes.py\", line 1653, in accept\r\n File \"mypy/checkexpr.py\", line 197, in visit_name_expr\r\n File \"mypy/checkexpr.py\", line 224, in analyze_ref_expr\r\n File \"mypy/checkmember.py\", line 969, in type_object_type\r\nValueError: value is not in list\r\n```\r\n\r\nsteps to reproduce:\r\n\r\n1. using Python 3.10.0 in case that's important\r\n2. dmypy 0.950 - this is a straight install from pypi, though ive had the issue in the past running from a source install also \r\n3. git clone SQLAlchemy from gerrit and cd into new directory:\r\n\r\n```\r\n$ git clone https://gerrit.sqlalchemy.org/sqlalchemy/sqlalchemy\r\n$ cd sqlalchemy\r\n\r\n```\r\n\r\n4. download a specific patch that is reproducing the issue:\r\n\r\n```\r\n$ git fetch https://gerrit.sqlalchemy.org/sqlalchemy/sqlalchemy refs/changes/25/3825/2 && git checkout FETCH_HEAD\r\n```\r\n\r\n5. start dmypy and run an initial check against lib. there's about 50 typing errors generated as expected\r\n\r\n```\r\n$ dmypy start\r\n$ dmypy check lib\r\n... output follows ...\r\nFound 50 errors in 1 file (checked 700 source files)\r\n\r\n```\r\n\r\n6. make any change, like adding a blank line, to lib/sqlalchemy/orm/decl_api.py:\r\n\r\n```\r\n$ printf \"\\n\" >> lib/sqlalchemy/orm/decl_api.py\r\n```\r\n\r\n7. run \"dmypy recheck\". crash\r\n\r\n```\r\n$ dympy recheck\r\n\r\n... stack trace...\r\n File \"mypy/checkexpr.py\", line 197, in visit_name_expr\r\n File \"mypy/checkexpr.py\", line 224, in analyze_ref_expr\r\n File \"mypy/checkmember.py\", line 969, in type_object_type\r\nValueError: value is not in list\r\n\r\n```\r\n\r\nI'm able to reproduce this from running the steps above in a brand new directory.\r\n\r\nI fully expect there is something in my code making it do this which I am sure is some horrible mistake I'm making, however, dmypy should tell me what the mistake is rather than crashing. Thanks and sorry for the complex reproduction instructions\r\n\r\n\r\n","author":{"url":"https://github.com/zzzeek","@type":"Person","name":"zzzeek"},"datePublished":"2022-05-07T16:15:24Z","url":"https://github.com/python/mypy/issues/12744"}
| 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:f2d064e1-4331-1a6e-1f87-8fe8ff7ff439 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C13A:1B0A31:22D18A6:2F671AB:6B002CB8 |
| html-safe-nonce | e275a7ed614355230b591461903ae453badbb0be7e177e040c53ae15f3f26942 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTNBOjFCMEEzMToyMkQxOEE2OjJGNjcxQUI6NkIwMDJDQjgiLCJ2aXNpdG9yX2lkIjoiMzIyMjE0MDI1ODg3OTU0ODYwMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 084c95e40d94d13b5945e1a55f8295a41c8047f271e143a5e3576044e5e5b2e4 |
| hovercard-subject-tag | issue:1228664708 |
| 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/12744/issue_layout |
| twitter:image | https://opengraph.githubassets.com/02b96d5083f48d3c5b6cca0c5d13fd8e072ec7bf13a65a82ce98ef919ae923c9/python/mypy/issues/12744 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/02b96d5083f48d3c5b6cca0c5d13fd8e072ec7bf13a65a82ce98ef919ae923c9/python/mypy/issues/12744 |
| og:image:alt | I've had problems with this situation on and off for many weeks now, with 0.941 and now 0.950. sometimes it isn't happening at all, and other times, like at the moment, I get this stack trace relia... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zzzeek |
| 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