Skip to content

Breakpoints can be set on blank/comment-only lines but never resolve or warn #2013

Closed

Description

Environment\n- OS: Linux\n- Python: 3.13 (debug session shows /usr/lib/python3.13/...)\n- Debug adapter: debugpy (via VS Code Python extension), e.g. ms-python.debugpy-2025.18.0-linux-x64\n- Frontend: VS Code Run & Debug\n\nSteps to Reproduce\n1. In a Python file, create a breakpoint on a line that is not an executable statement (blank line or comment-only line).\n2. Start debugging normally and run through code that would execute the surrounding executable lines.\n\nActual Result\n- The breakpoint can be set/accepted in the UI, but it never triggers.\n- There is no clear indication that the breakpoint line has no executable code and therefore cannot be hit.\n\nExpected Result\n- The debugger should either\n - prevent breakpoints on non-executable lines, or\n - clearly mark them as unverified / not resolved, and/or\n - resolve them automatically to the nearest executable line.\n\nNotes / Example\nIn this codebase, a breakpoint placed on a blank line between executable statements never resolves or triggers, even though the immediately adjacent executable lines do execute.\n\nWorkaround\nPlace breakpoints on actual executable statement lines instead.

Activity

  1. rchiodo commented on Mar 20, 2026

    @rchiodo
    Contributor

    It does search for lines that are close, it all depends upon how far off the blank line or the commented line is.

    For example with this code:

    def my_func():
        # Some lines with comments
        # more comments
        # more comments
        # more comments
        # more comments
        print("Hello, World!")
        # comments after the print statement
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        # more comments
        
        
    
    if __name__ == "__main__":
        my_func()

    No matter where I put a breakpoint in my_func, it will bind the breakpoint somewhere.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions