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. 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.
reproduction steps follow below. the crash is:
$ dmypy check lib
Daemon crashed!
Traceback (most recent call last):
File "mypy/dmypy_server.py", line 230, in serve
File "mypy/dmypy_server.py", line 273, in run_command
File "mypy/dmypy_server.py", line 341, in cmd_check
File "mypy/dmypy_server.py", line 394, in check
File "mypy/dmypy_server.py", line 569, in fine_grained_increment_follow_imports
File "mypy/server/update.py", line 245, in update
File "mypy/server/update.py", line 328, in update_one
File "mypy/server/update.py", line 393, in update_module
File "mypy/server/update.py", line 615, in update_module_isolated
File "mypy/build.py", line 2192, in type_check_first_pass
File "mypy/checker.py", line 319, in check_first_pass
File "mypy/checker.py", line 427, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 1021, in accept
File "mypy/checker.py", line 1810, in visit_class_def
File "mypy/checker.py", line 427, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 1092, in accept
File "mypy/checker.py", line 2174, in visit_block
File "mypy/checker.py", line 427, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 740, in accept
File "mypy/checker.py", line 776, in visit_func_def
File "mypy/checker.py", line 780, in _visit_func_def
File "mypy/checker.py", line 842, in check_func_item
File "mypy/checker.py", line 1027, in check_func_def
File "mypy/checker.py", line 427, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 1092, in accept
File "mypy/checker.py", line 2174, in visit_block
File "mypy/checker.py", line 427, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checker.py", line 425, in accept
File "mypy/nodes.py", line 1316, in accept
File "mypy/checker.py", line 3581, in visit_if_stmt
File "mypy/checkexpr.py", line 3983, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checkexpr.py", line 3981, in accept
File "mypy/nodes.py", line 1897, in accept
File "mypy/checkexpr.py", line 2244, in visit_comparison_expr
File "mypy/checkexpr.py", line 3983, in accept
File "mypy/errors.py", line 902, in report_internal_error
File "mypy/checkexpr.py", line 3981, in accept
File "mypy/nodes.py", line 1653, in accept
File "mypy/checkexpr.py", line 197, in visit_name_expr
File "mypy/checkexpr.py", line 224, in analyze_ref_expr
File "mypy/checkmember.py", line 969, in type_object_type
ValueError: value is not in list
steps to reproduce:
- using Python 3.10.0 in case that's important
- dmypy 0.950 - this is a straight install from pypi, though ive had the issue in the past running from a source install also
- git clone SQLAlchemy from gerrit and cd into new directory:
$ git clone https://gerrit.sqlalchemy.org/sqlalchemy/sqlalchemy
$ cd sqlalchemy
- download a specific patch that is reproducing the issue:
$ git fetch https://gerrit.sqlalchemy.org/sqlalchemy/sqlalchemy refs/changes/25/3825/2 && git checkout FETCH_HEAD
- start dmypy and run an initial check against lib. there's about 50 typing errors generated as expected
$ dmypy start
$ dmypy check lib
... output follows ...
Found 50 errors in 1 file (checked 700 source files)
- make any change, like adding a blank line, to lib/sqlalchemy/orm/decl_api.py:
$ printf "\n" >> lib/sqlalchemy/orm/decl_api.py
- run "dmypy recheck". crash
$ dympy recheck
... stack trace...
File "mypy/checkexpr.py", line 197, in visit_name_expr
File "mypy/checkexpr.py", line 224, in analyze_ref_expr
File "mypy/checkmember.py", line 969, in type_object_type
ValueError: value is not in list
I'm able to reproduce this from running the steps above in a brand new directory.
I 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