python / python/mypy

`--untyped-calls-exclude` does not work with `super()`

未关闭
#16,653 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
Python
星标
20.6k
派生
3.3k
PR 合并指标
PR 指标待抓取

描述

Bug Report

--untyped-calls-exclude does not work with super()

To Reproduce

class Super:
    def draw(self):
        ...

class Class(Super):
    def draw(self) -> None:
        super().draw()

Class().draw()

Expected Behavior

No error.

Actual Behavior

(.venv) C:\Build>mypy --no-incremental --disallow-untyped-calls --untyped-calls-exclude=bug --untyped-calls-exclude=bug.Super --untyped-calls-exclude=bug.Class bug.py
bug.py:7: error: Call to untyped function "draw" in typed context  [no-untyped-call]
Found 1 error in 1 file (checked 1 source file)

Your Environment

  • Mypy version used: 1.7.1.
  • Mypy command-line flags: see above
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 3.12.1

Related: https://github.com/python/mypy/issues/16651

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

先使用所示的 bug.py 示例复现 issue 中的命令,然后跟踪 --untyped-calls-exclude 如何应用于 super() 调用。当示例不产生错误,并且有一个回归测试覆盖被排除的 super() 调用时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
devtools
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。