GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pdb does not stop at a breakpoint set on the line of a function definition · Issue #59013 · python/cpython

Pdb does not stop at a breakpoint set on the line of a function definition #59013

New issue
Copy link
New issue
Copy link
Closed
Closed
Pdb does not stop at a breakpoint set on the line of a function definition#59013
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

xdegaye
mannequin
opened on May 14, 2012
Issue body actions
BPO 14808
Nosy @birkenfeld, @xdegaye
Files
  • pdb_default.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2012-05-14.15:36:58.639>
    labels = ['type-bug', 'library']
    title = 'Pdb does not stop at a breakpoint set on the line of a function definition'
    updated_at = <Date 2012-05-25.11:56:43.789>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2012-05-25.11:56:43.789>
    actor = 'xdegaye'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-05-14.15:36:58.639>
    creator = 'xdegaye'
    dependencies = []
    files = ['25578']
    hgrepos = []
    issue_num = 14808
    keywords = ['patch']
    message_count = 2.0
    messages = ['160629', '161574']
    nosy_count = 2.0
    nosy_names = ['georg.brandl', 'xdegaye']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue14808'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    Linked PRs

    • gh-59013: Make line number of function breakpoint more precise #110582
    • gh-59013: Set breakpoint on the first executable line in pdb when using break func #112470

    Activity

    1. xdegaye commented on May 14, 2012

      @xdegaye
      xdegayemannequin
      on May 14, 2012
      MannequinAuthor
      More actions

      In the following test both breakpoints are set on the line of a
      function definition. However pdb does not stop when entering foo whose
      breakpoint has been set with 'break 1' while pdb stops when entering
      bar whose breakpoint has been set with 'break bar'. The breakpoint
      table display is identical for both breakpoints. This is inconsistent
      and confusing.

      === main.py ==================================
      1 def foo():
      2 pass
      3
      4 def bar():
      5 pass
      6
      7 def main():
      8 foo()
      9 bar()
      10
      11 import pdb; pdb.runcall(main)
      =================================================

      $ python main.py
      > /path_to/main.py(8)main()
      -> foo()
      (Pdb) break 1
      Breakpoint 1 at /path_to/main.py:1
      (Pdb) break bar
      Breakpoint 2 at /path_to/main.py:4
      (Pdb) break
      Num Type         Disp Enb   Where
      1   breakpoint   keep yes   at /path_to/main.py:1
      2   breakpoint   keep yes   at /path_to/main.py:4
      (Pdb) continue
      > /path_to/main.py(5)bar()
      -> pass
      (Pdb) continue
      $

      =================================================

      The reverse occurs in the following test where pdb stops only at the
      execution of the function definition when the breakpoint has been set
      with a line number.

      === main.py ==================================
      1 x = 1
      2
      3 def foo():
      4 pass
      5
      6 def bar():
      7 pass
      8
      9 x = 2
      =================================================

      $ python -m pdb main.py
      > /path_to/main.py(1)<module>()
      -> x = 1
      (Pdb) break 3
      Breakpoint 1 at /path_to/main.py:3
      (Pdb) break bar
      Breakpoint 2 at /path_to/main.py:6
      (Pdb) break 9
      Breakpoint 3 at /path_to/main.py:9
      (Pdb) break
      Num Type         Disp Enb   Where
      1   breakpoint   keep yes   at /path_to/main.py:3
      2   breakpoint   keep yes   at /path_to/main.py:6
      3   breakpoint   keep yes   at /path_to/main.py:9
      (Pdb) continue
      > /path_to/main.py(3)<module>()
      -> def foo():
      (Pdb) continue
      > /path_to/main.py(9)<module>()
      -> x = 2
      (Pdb)

      =================================================

      The following patch fixes both inconsistencies by having pdb stop when
      entering a function and at the execution of a definition whatever the
      method used to set the breakpoint (line number or function name).

      Two test cases are included in the patch.

    2. xdegaye
      added
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on May 14, 2012
    3. xdegaye commented on May 25, 2012

      @xdegaye
      xdegayemannequin
      on May 25, 2012
      MannequinAuthor
      More actions

      Parsing the modules source seems a better way to fix this problem, see bpo-14913.

    4. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    5. iritkatriel
      added a commit that references this issue on Oct 27, 2023

      gh-59013: Make line number of function breakpoint more precise (#110582)

      1c9a0c4
    6. gaogaotiantian commented on Oct 27, 2023

      @gaogaotiantian
      gaogaotiantian
      on Oct 27, 2023
      Member
      More actions

      With #110852, break func will assign the correct line number for function that is already defined.

    7. iritkatriel
      added a commit that references this issue on Oct 29, 2023

      pythongh-59013: Make line number of function breakpoint more precise (p…

      3aeffca
    8. hugovk commented on Nov 27, 2023

      @hugovk
      hugovk
      on Nov 27, 2023
      Member
      More actions

      Fixed by #110582, thanks!

    9. hugovk
      closed this as completedon Nov 27, 2023
    10. gaogaotiantian commented on Nov 27, 2023

      @gaogaotiantian
      gaogaotiantian
      on Nov 27, 2023
      Member
      More actions

      Actually, there's still a case that's inconsistent. I did not figure out a solution then but I have a patch now. Let's reopen this and close it after the new PR is merged.

      Reacted by Hugo van Kemenade
    11. gaogaotiantian
      reopened this on Nov 27, 2023
    12. iritkatriel
      added a commit that references this issue on Jan 31, 2024

      gh-59013: Set breakpoint on the first executable line of function whe…

      765b9ce
    13. gaogaotiantian commented on Feb 2, 2024

      @gaogaotiantian
      gaogaotiantian
      on Feb 2, 2024
      Member
      More actions

      With #112470 merged, this problem is fully fixed.

      Reacted by Hugo van Kemenade
    14. gaogaotiantian
      closed this as completedon Feb 2, 2024
    15. aisk
      added 2 commits that reference this issue on Feb 11, 2024

      pythongh-59013: Make line number of function breakpoint more precise (p…

      5c271de

      pythongh-59013: Set breakpoint on the first executable line of functi…

      24c44c0
    16. Glyphack
      added a commit that references this issue on Sep 2, 2024

      pythongh-59013: Make line number of function breakpoint more precise (p…

      a3b8768
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.