diff options
author | huzhaojie <hu.zj@foxmail.com> | 2021-06-11 15:17:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-11 15:17:56 (GMT) |
commit | 4cb6ba14325cff98589c2660d1d2c65f4aacfee4 (patch) | |
tree | 98423b2f7d16821068171f58d4c819c368e95962 | |
parent | fc98266ff627ba0f56f8ae241245b66bc983baa3 (diff) | |
download | cpython-4cb6ba14325cff98589c2660d1d2c65f4aacfee4.zip cpython-4cb6ba14325cff98589c2660d1d2c65f4aacfee4.tar.gz cpython-4cb6ba14325cff98589c2660d1d2c65f4aacfee4.tar.bz2 |
bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646)
-rwxr-xr-x | Lib/pdb.py | 2 | ||||
-rw-r--r-- | Lib/test/test_pdb.py | 29 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2021-02-25-08-32-06.bpo-43318.bZJw6V.rst | 1 |
3 files changed, 31 insertions, 1 deletions
@@ -893,7 +893,7 @@ class Pdb(bdb.Bdb, cmd.Cmd): except ValueError: err = "Invalid line number (%s)" % arg else: - bplist = self.get_breaks(filename, lineno) + bplist = self.get_breaks(filename, lineno)[:] err = self.clear_break(filename, lineno) if err: self.error(err) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index aa3035b..0724b66 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -1322,6 +1322,35 @@ def test_pdb_issue_20766(): pdb 2: <built-in function default_int_handler> """ +def test_pdb_issue_43318(): + """echo breakpoints cleared with filename:lineno + + >>> def test_function(): + ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace() + ... print(1) + ... print(2) + ... print(3) + ... print(4) + >>> reset_Breakpoint() + >>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE + ... 'break 3', + ... 'clear <doctest test.test_pdb.test_pdb_issue_43318[0]>:3', + ... 'continue' + ... ]): + ... test_function() + > <doctest test.test_pdb.test_pdb_issue_43318[0]>(3)test_function() + -> print(1) + (Pdb) break 3 + Breakpoint 1 at <doctest test.test_pdb.test_pdb_issue_43318[0]>:3 + (Pdb) clear <doctest test.test_pdb.test_pdb_issue_43318[0]>:3 + Deleted breakpoint 1 at <doctest test.test_pdb.test_pdb_issue_43318[0]>:3 + (Pdb) continue + 1 + 2 + 3 + 4 + """ + class PdbTestCase(unittest.TestCase): def tearDown(self): diff --git a/Misc/NEWS.d/next/Library/2021-02-25-08-32-06.bpo-43318.bZJw6V.rst b/Misc/NEWS.d/next/Library/2021-02-25-08-32-06.bpo-43318.bZJw6V.rst new file mode 100644 index 0000000..c2c9c87 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-02-25-08-32-06.bpo-43318.bZJw6V.rst @@ -0,0 +1 @@ +Fix a bug where :mod:`pdb` does not always echo cleared breakpoints. |