python / python/mypy

dmypy: Line number disappears when invoking multiple times

Open
#12,498 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-daemon topic-error-reporting
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Bug Report

% dmypy restart
Daemon stopped
Daemon started
% dmypy run lib/testlib.py
lib/testlib.py:46: error: Unexpected attribute "xxxx" for model "Xxxx"
lib/testlib.py:142: error: The return type of a generator function should be "Generator" or one of its supertypes
Found 2 errors in 1 file (checked 945 source files)
% dmypy run lib/testlib.py
lib/testlib.py: error: The return type of a generator function should be "Generator" or one of its supertypes
lib/testlib.py:46: error: Unexpected attribute "xxxx" for model "Xxxx"
Found 2 errors in 1 file (checked 1 source file)

Note in the 2nd invocation lib/testlib.py: error: The return type of a generator function no longer has a line number.

To Reproduce

I tried reducing this to a smaller example, but failed to reproduce it that way. :(

Your Environment

  • Mypy version used: 0.942
  • Mypy command-line flags: (none)
  • Mypy configuration options from mypy.ini (and other config files): I can reproduce this when I delete mypy config of my project
  • Python version used: 3.10.2
  • Operating system and version: macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the two successive dmypy run lib/testlib.py commands after dmypy restart, using the reported Python 3.10.2 setup and no mypy configuration. Compare the diagnostics for lib/testlib.py, especially the generator error that loses its line number on the second run. Done means repeated invocations preserve the line number while retaining the existing diagnostic output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.