`dmypy suggest` crashes if the checked files emit messages and suggesting a stdlib function (?)
Open
Nobody has claimed this yet.
crash
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
$ dmypy run -- --config-file=mypy-test.ini
Daemon started
pkg/__init__.py:1: note: Revealed type is "Literal[1]?"
Success: no issues found in 1 source file
$ dmypy suggest os.path.islink --callsites
pkg/__init__.py:1: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
...
File ".../mypy/errors.py", line 684, in _add_error_info
assert file not in self.flushed_files
Project:
mypy-test.ini:[mypy] files = pkg/pkg/__init__.pyreveal_type(1)
The crash happens when:
- One of the modules that are checked is emitting some kind of message (either note or error);
- The suggestion is something from mypy's automatically loaded modules (I've only tested standard library ones). Suggesting something from the checked modules does not cause the crash.
Your Environment
- Mypy version used: 2.3, master
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.13
- Operating system and version: Ubuntu 22.04
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce with the shown mypy-test.ini, pkg/init.py, and the dmypy run and dmypy suggest os.path.islink --callsites commands. Start at mypy/errors.py line 684 and trace how messages are flushed before suggestions for automatically loaded modules. Done means the suggestion no longer crashes when checked files emit notes or errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100