Feature: Support `filename:function` syntax for pdb break and clear command
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pdb's existing break and clear command handling, comparing the filename:lineno and function resolution paths. Reproduce the main.py example with b main:foo, then verify that filename:function works without regressing the existing forms; the issue references linked PR gh-142470.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100