Skip to content

Breakpoints not honored after autoreloading #2001

Description

@memeplex

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.20
  • OS and version: macOS Tahoe
  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.5
  • Using VS Code or Visual Studio: VSCode

Actual behavior

In a Jupyter Notebook I have:

%load_ext autoreload
%autoreload 2

The notebook imports another module, let's say import util.

I set a breakpoint in util.py and launch the debugger from a cell calling some function util.fun. So far so good.

Now, after the debugging session ends, I do some changes in util.py, say rename util.fun to util.fun2. If I then launch the debugger from a cell calling util.fun2, debugpy doesn't stop at the breakpoint anymore.

In my example I was renaming a function, but this happens after other, more innocent looking, changes too.

Calling importlib.reload(util) fixes the issue. OTOH removing and readding the breakpoints has no effect at all.

Expected behavior

Breakpoints are honored after autoreloading.

Steps to reproduce:

The description provided a simple example.

Activity

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