Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setting a bp on current function, Pdb stops at next line although no bp #58997

Closed
xdegaye mannequin opened this issue May 12, 2012 · 3 comments
Closed

setting a bp on current function, Pdb stops at next line although no bp #58997

xdegaye mannequin opened this issue May 12, 2012 · 3 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@xdegaye
Copy link
Mannequin

xdegaye mannequin commented May 12, 2012

BPO 14792
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-12.19:50:48.050>
    labels = ['type-bug', 'library']
    title = 'setting a bp on current function, Pdb stops at next line although no bp'
    updated_at = <Date 2012-05-25.11:55:09.740>
    user = 'https://github.com/xdegaye'

    bugs.python.org fields:

    activity = <Date 2012-05-25.11:55:09.740>
    actor = 'xdegaye'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-05-12.19:50:48.050>
    creator = 'xdegaye'
    dependencies = []
    files = ['25553']
    hgrepos = []
    issue_num = 14792
    keywords = ['patch']
    message_count = 2.0
    messages = ['160489', '161572']
    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/issue14792'
    versions = ['Python 2.7', 'Python 3.2', 'Python 3.3']

    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 12, 2012

    Setting a breakpoint on a function from within that functions makes
    pdb to stop at the following line (where no breakpoint is set) after a
    continue command. In the following test pdb stops at line 3 where
    there is no breakpoint.

    === main.py =================================

    def foo():
        x = 1
        x = 2
    
    foo()

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

    $ python -m pdb main.py
    > /path_to/main.py(1)<module>()
    -> def foo():
    (Pdb) import sys; print(sys.version)
    3.3.0a3+ (default:4e9680570be8, May 11 2012, 12:09:15) 
    [GCC 4.3.2]
    (Pdb) break 2
    Breakpoint 1 at /path_to/main.py:2
    (Pdb) continue
    > /path_to/main.py(2)foo()
    -> x = 1
    (Pdb) break foo
    Breakpoint 2 at /path_to/main.py:1
    (Pdb) continue
    > /path_to/main.py(3)foo()
    -> x = 2
    (Pdb) where
      /home/xavier/src/cpython/cpython-hg-default/Lib/bdb.py(405)run()
    -> exec(cmd, globals, locals)
      <string>(1)<module>()
      /path_to/main.py(5)<module>()
    -> foo()
    > /path_to/main.py(3)foo()
    -> x = 2
    (Pdb) quit

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

    The attached patch fixes the problem. The patch includes a test case.

    @xdegaye xdegaye mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 12, 2012
    @xdegaye
    Copy link
    Mannequin Author

    xdegaye mannequin commented May 25, 2012

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

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @gaogaotiantian
    Copy link
    Member

    This is already fixed as the breakpoint on functions already uses source parsing.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant