mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
gh-104301: Allow leading whitespace in disambiguated pdb statements (#104342)
This commit is contained in:
parent
27419a71b5
commit
0449ffe3a4
5 changed files with 50 additions and 12 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue