summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 482c92d..037673d 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1798,6 +1798,29 @@ def test_pdb_issue_gh_101517():
(Pdb) continue
"""
+def test_pdb_ambiguous_statements():
+ """See GH-104301
+
+ Make sure that ambiguous statements prefixed by '!' are properly disambiguated
+
+ >>> with PdbTestInput([
+ ... '! n = 42', # disambiguated statement: reassign the name n
+ ... 'n', # advance the debugger into the print()
+ ... 'continue'
+ ... ]):
+ ... n = -1
+ ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+ ... print(f"The value of n is {n}")
+ > <doctest test.test_pdb.test_pdb_ambiguous_statements[0]>(8)<module>()
+ -> print(f"The value of n is {n}")
+ (Pdb) ! n = 42
+ (Pdb) n
+ The value of n is 42
+ > <doctest test.test_pdb.test_pdb_ambiguous_statements[0]>(1)<module>()
+ -> with PdbTestInput([
+ (Pdb) continue
+ """
+
@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):