Mypy ignores typing.no_type_check for nested function redefintions.
Open
Nobody has claimed this yet.
bug
topic-pep-484
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
Mypy ignores no_type_check, specifically for nested function redefinitions.

To Reproduce
- Create a nested function.
- Create another nested function in the same name right after it.
- Attempt to suppress it with
@typing.no_type_check.
I've tried to deal with it in many ways, including opening a different bug, to no avail.
Your Environment
- Mypy version used: 0.800
- Mypy command-line flags: --disallow-untyped-defs, --show-column-numbers, --follow-imports=silent, --ignore-missing-imports, --check-untyped-defs
- Mypy configuration options from
mypy.ini(and other config files): Nope - Python version used: 3.9.0
- Operating system and version: Windows 10
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
Start by reproducing the nested-function redefinition described in the issue with Python 3.9.0, mypy 0.800, and the listed command-line flags. Confirm how @typing.no_type_check behaves and compare the diagnostic; done means the intended suppression works for the nested redefinition.
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
- 35/100