concurrent.futures: Bad signature for Executor.submit() under Python <= 3.8
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 5.1k
- 派生
- 2.1k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 82
描述
Reproducer
python3.8 -m venv /tmp/py38
source /tmp/py38/bin/activate
pip -q install mypy
stubtest concurrent.futures
Tentative fix
diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi
index 5b756d87..fc6a342c 100644
--- a/stdlib/concurrent/futures/_base.pyi
+++ b/stdlib/concurrent/futures/_base.pyi
@@ -60,7 +60,7 @@ class Future(Generic[_T]):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class Executor:
- if sys.version_info >= (3, 9):
+ if sys.version_info >= (3, 8):
def submit(self, __fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ...
else:
def submit(self, fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ...
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 stdlib/concurrent/futures/_base.pyi 开始,使用 Python 3.8 虚拟环境和上面显示的 stubtest concurrent.futures 命令复现该问题。检查 Python 3.8 下 Executor.submit() 签名的条件,并在 Python �3c= 3.8 上 stubtest 报告正确签名时认为 issue 已完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100