python / python/mypy

Mypy ignores typing.no_type_check for nested function redefintions.

Open
#10,002 3 comments 2 reactions 0 assignees View on GitHub

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.

image

To Reproduce

  1. Create a nested function.
  2. Create another nested function in the same name right after it.
  3. 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.