python / python/cpython

-m trace --count missing lines

オープン
#142,867 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Python スニペットで不一致を再現し、3.13 と 3.14 の coverage 出力を比較します。レポートで実行されたアノテーションについて意見が一致していないと特定されている trace.Trace.run と trace._get_executable_linenos を調査します。両方のパスが一致し、クラス属性の type hint を含む type-hint 行が一貫した coverage 結果を受け取れば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。