python / python/cpython

`pdb` commands may try to access non-existing frames

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

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

stdlib type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:
➜  cpython git:(main) ./python.exe
Python 3.15.0a0 (heads/main:919c7e806e, Sep  8 2025, 17:24:03) [Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> breakpoint()
> <python-input-0>(1)<module>()
(Pdb) breakpoint()
(Pdb) ll
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    breakpoint()
    ~~~~~~~~~~^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 94, in wrapper
    ret = func(frame, *args)
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 154, in opcode_callback
    frame.f_trace(frame, 'opcode', None)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 289, in trace_dispatch
    return self.dispatch_opcode(frame, arg)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/bdb.py", line 406, in dispatch_opcode
    self.user_opcode(frame)
    ~~~~~~~~~~~~~~~~^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/pdb.py", line 547, in user_line
    self.interaction(frame, None)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/pdb.py", line 736, in interaction
    self._cmdloop()
    ~~~~~~~~~~~~~^^
  File "/Users/hyi/prs/cpython/Lib/pdb.py", line 601, in _cmdloop
    self.cmdloop()
    ~~~~~~~~~~~~^^
  File "/Users/hyi/prs/cpython/Lib/cmd.py", line 149, in cmdloop
    stop = self.onecmd(line)
  File "/Users/hyi/prs/cpython/Lib/pdb.py", line 1038, in onecmd
    return cmd.Cmd.onecmd(self, line)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/hyi/prs/cpython/Lib/cmd.py", line 227, in onecmd
    return func(arg)
  File "/Users/hyi/prs/cpython/Lib/pdb.py", line 2156, in do_longlist
    filename = self.curframe.f_code.co_filename
               ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'f_code'
>>> 
CPython versions tested on:

3.15, CPython main branch

Operating systems tested on:

Other

Linked PRs
  • gh-138642

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

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

はじめの一歩

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

調査の方向性

Lib/pdb.py の do_longlist から始め、コマンドループを通じて到達する frame の状態を調べてください。traceback では、呼び出しパスの一部として Lib/bdb.py も特定されます。breakpoint() と ll のシーケンスを再現し、現在の frame が存在しない場合でも pdb コマンドが AttributeError を発生させなくなっていることを確認してください。

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

評価

技術スタック
python
領域
cli, devtools
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

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

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