python / python/cpython

Feature: Support `filename:function` syntax for pdb break and clear command

Đang mở
#142,468 0 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-feature
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ả

Feature or enhancement

Proposal:

Currently, pdb's break command supports filename:lineno or just function (in the current context or imported modules). However, it does not support the filename:function syntax.

Attempting to use break filename:function usually results in a Error because pdb expects the part after the colon to be a line number.

main.py:

def foo():
    pass
bash-5.3# ./python -m pdb main.py
> /workspaces/cpython/main.py(1)<module>()
-> def foo():
(Pdb) b main:foo
*** Bad lineno: foo

This syntax is useful for specifying a function in a specific file, especially to disambiguate if multiple files have the same function name, or if the file hasn't been loaded yet but the user wants to be explicit.

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-142470

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 với phần xử lý hiện có các lệnh break và clear của pdb, so sánh các đường dẫn phân giải filename:lineno và function. Tái hiện ví dụ main.py bằng b main:foo, sau đó xác minh rằng filename:function hoạt động mà không làm phát sinh hồi quy ở các dạng hiện có; issue tham chiếu đến PR được liên kết gh-142470.

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
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
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
25/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.