python / python/cpython

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

Đang mở
#138,641 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

stdlib type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu tại Lib/pdb.py ở do_longlist và kiểm tra trạng thái frame đạt được thông qua vòng lặp lệnh; traceback cũng xác định Lib/bdb.py là một phần của đường dẫn gọi. Tái hiện chuỗi breakpoint() và ll, sau đó xác minh rằng các lệnh pdb không còn phát sinh AttributeError khi không tồn tại frame hiện tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
cli, devtools
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.