python / python/mypy

dmypy run stuck with previous module names

Open
#8,206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Using mypy 0.760
I have imp.py

class A:
        pass

and main.py

from imp import *

a=A()

If I run dmypy run -- --follow-imports=skip main.py it will correctly fail because it's not able to import imp.py
But if then I do dmypy run -- --follow-imports=skip . after checking only main.py it will incorrectly fail

dmypy run -- --follow-imports=skip .      
main.py:3: error: Name 'A' is not defined

If I change imp.py or restart the daemon, the error disappears (a cache issue?)

thanks!

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

Reproduce the sequence with imp.py and main.py: first run dmypy with --follow-imports=skip on main.py, then run it on ., and compare the diagnostics with a fresh daemon or after changing imp.py. Start at the dmypy daemon and its cache/state handling. Done means the second run no longer retains the stale Name 'A' is not defined error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.