python / python/mypy

Duplicate module silently replaces existing module in dmypy recheck --update

Open
#6,653 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority-0-high topic-daemon topic-fine-grained-incremental
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

If one has these two files:

# [file a/mod.py]
# empty

# [file b/mod.py]
42 + 'no'

and there are no __init__.py[i] files in the directories, then running dmypy produces the following result:

$ dmypy start -- --follow-import=skip
Daemon started
$ dmypy check a/mod.py 
$ dmypy recheck --update b/mod.py
b/mod.py:1: error: Unsupported operand types for + ("int" and "str")
$ dmypy recheck --remove b/mod.py
b/mod.py:1: error: Unsupported operand types for + ("int" and "str")
$ dmypy recheck --update a/mod.py
b/mod.py:1: error: Unsupported operand types for + ("int" and "str")

The problem here is twofold:

  • When we first trying to add the duplicate module, this should cause a blocking error, as in normal/incremental run instead of silently replacing the other module.
  • Even after one tries to remove the problematic module, it stays in build causing errors in all subsequent runs independently of what is done (except just stopping the daemon).

This is high priority because it causes troubles when adding files in existing large codebases.

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 dmypy start, check, recheck --update, recheck --remove, and recheck --update using the two duplicate mod.py files. Trace how the daemon handles duplicate modules during update and removal. Done means adding the duplicate reports a blocking error, removing it clears the stale module, and later rechecks no longer report its error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.