(🐞) `type` doesn't meet it's own type as a protocol
未关闭
还没有人认领这个 Issue。
bug
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- PR 合并指标
- PR 指标待抓取
描述
from typing import Protocol
class Type(Protocol):
__name__: str
__qualname__: str
__module__: str
a: type[object]
b: Type = object
c: Type = a # error: Incompatible types in assignment (expression has type "type[object]", variable has type "Type") [assignment]
a.__name__
a.__qualname__
a.__module__
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在提供的 Protocol 示例上运行 mypy,并将赋值诊断与对 type[object] 的属性访问成功进行比较。跟踪 Protocol 兼容性和类型对象的类型检查路径;完成的标准是示例以与声明的 Type protocol 一致的方式处理 type[object],且不使相关检查发生回归。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100