PR: Fix debugger stop in breakpoints set on modules if stop on first line option is disabled#575
Merged
ccordoba12 merged 1 commit intospyder-ide:masterfrom Feb 8, 2026
Merged
Conversation
(See [1] for a description of the fixed issue.) Spyder's debugger is based on Python's `pdb.Pdb` debugger. The latter attempts to stop at the first line of the code when the debugger is started. This is controlled by the `Pdb._wait_for_mainpyfile` attribute and (mainly) handled by `Pdb.user_line()`. Spyder, however, attempts to continue, unless Spyder's option "Stop debugging on first line of files without breakpoints" is set and there are no breakpoints in the "main" file. The continue used to be performed By issuing a `continue` command at the input prompt when the debugger stops for the first time. This has been changed by commit `55d767704` to a direct call of `Pdb.set_continue()` and returning `False` in `Pdb.stop_here()`. This prevents a call of `Pdb.user_line()` which would have reset `Pdb._wait_for_mainpyfile`. This breaks breakpoints in dependent modules (in modules used by the main file) when Spyder's "Stop debugging on first line of files without breakpoints" is _not_ set and there are no breakpoints in the main file: Given that there are no break points in the main file, the debugger never calls `Pdb.user_line()` for the main file. For any other file `user_line()` does not reset `_wait_for_mainpyfile` because it's not in the main file. Fix the issue by resetting `_wait_for_mainpyfile` at an appropriate time. This fixes spyder-ide/spyder#22035 [1] spyder-ide/spyder#22035
Member
|
@meeseeksdev please backport to 3.x |
meeseeksmachine
pushed a commit
to meeseeksmachine/spyder-kernels
that referenced
this pull request
Feb 8, 2026
…on modules if stop on first line option is disabled
ccordoba12
pushed a commit
that referenced
this pull request
Feb 8, 2026
…set on modules if stop on first line option is disabled) (#578)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses spyder-ide/spyder#22025. This is not the fix we have been using internally for some time. Looking at it again I came up with a simpler and (hopefully) better fix.
The commit has a detailed explanation. It's … somewhat convoluted due to many layers being involved (Python's
pdb.Pdb/bdb.Bdband Spyder's customizations).Please verify the fix, maybe @impact27 can give a hand. Unfortunately, I won't able to respond in the next two weeks to come.