[Python-checkins] bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646) (GH-26675)
iritkatriel
webhook-mailer at python.org
Fri Jun 11 12:18:53 EDT 2021
https://github.com/python/cpython/commit/6df926f1c46eb6db7b5dcd0227c6b532c78525c9
commit: 6df926f1c46eb6db7b5dcd0227c6b532c78525c9
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2021-06-11T17:18:49+01:00
summary:
bpo-43318: Fix a bug where pdb does not always echo cleared breakpoints (GH-24646) (GH-26675)
(cherry picked from commit 4cb6ba14325cff98589c2660d1d2c65f4aacfee4)
Co-authored-by: huzhaojie <hu.zj at foxmail.com>
files:
A Misc/NEWS.d/next/Library/2021-02-25-08-32-06.bpo-43318.bZJw6V.rst
M Lib/pdb.py
M Lib/test/test_pdb.py
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 081a8449d4109..ff40f7b2476a3 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -893,7 +893,7 @@ def do_clear(self, arg):
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 2339bff1a253b..1c007a2b6fc8d 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1259,6 +1259,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 0000000000000..c2c9c8776fd86
--- /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.
More information about the Python-checkins
mailing list