-m trace --count missing lines
未关闭
还没有人认领这个 Issue。
stdlib
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
def x() -> tuple[
int,
]:
return (1, 'fred')
x()
python 3.13 (good):
xju@xjutv:~/tmp$ python3 --version
Python 3.13.1
xju@xjutv:~/tmp$ rm -f xxx.cover
xju@xjutv:~/tmp$ python3 -m trace --count -m xxx.py
xju@xjutv:~/tmp$ cat xxx.cover
2: def x() -> tuple[
1: int,
]:
1: return (1, 'fred')
1: x()
python 3.14 (bad):
xju@xjutv:~/tmp$ python3 --version
Python 3.14.2
xju@xjutv:~/tmp$ rm -f xxx.cover
xju@xjutv:~/tmp$ python3 -m trace --count -m xxx.py
xju@xjutv:~/tmp$ cat xxx.cover
1: def x() -> tuple[
>>>>>> int,
]:
1: return (1, 'fred')
1: x()
... trace._get_executable_linenos returns the same in both 3.13 and 3.14; seems that Trace.run does not see that the type hint is "executed"? Could equally have trace._get_executable_linenos not report the type hint... they just need to agree.
Above is about the simplest example I came up with, but similar disagreement with class attribute hints like:
class X:
a: int
... a: int is reported as "not covered".
CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs
- gh-143161
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用 Python 代码片段重现差异,并比较 3.13 和 3.14 的 coverage 输出。检查 trace.Trace.run 和 trace._get_executable_linenos;报告指出它们对于已执行的注解存在不一致。完成标准是两条路径达成一致,并且包含 type hint 的行(包括类属性 hint)获得一致的 coverage 结果。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100