`pdb` commands may try to access non-existing frames
未關閉
還沒有人認領這個 Issue。
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 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