python / python/cpython

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

Open
#142,468 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stdlib type-feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.