◐ Shell
clean mode source ↗

bpo-24160: Fix breakpoints persistence across multiple pdb sessions by iritkatriel · Pull Request #21989 · python/cpython

The information about breakpoints is split between Breakpoint.bplist/Breakpoint.bpbynumber (at class scope) and the breaks dictionary that lives on the Bdb() instance. The problems described in issue24160 occurs when those two parts get out of sync.

In interactive mode, each pdb.run() call creates a new instance of Bdb(). In this case the user would like the breakpoints to be remembered between calls. This PR adds a function _load_breaks to Bdb, which is called in its constructor and populates the instance's breaks dict with the data from the Breakpoint class.

Tests were added in both test_bdb (to test it directly) and in test_pdb (to test it with the interactive usecase).

https://bugs.python.org/issue24160