Skip to content

Commit 7c1b0a4

Browse files
gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547)
1 parent 3d71b5e commit 7c1b0a4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Lib/test/test_pdb.py

+20
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,26 @@ def test_pdb_issue_gh_103225():
17001700
(Pdb) continue
17011701
"""
17021702

1703+
def test_pdb_issue_gh_101517():
1704+
"""See GH-101517
1705+
1706+
Make sure pdb doesn't crash when the exception is caught in a try/except* block
1707+
1708+
>>> def test_function():
1709+
... try:
1710+
... raise KeyError
1711+
... except* Exception as e:
1712+
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
1713+
1714+
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
1715+
... 'continue'
1716+
... ]):
1717+
... test_function()
1718+
--Return--
1719+
> <doctest test.test_pdb.test_pdb_issue_gh_101517[0]>(None)test_function()->None
1720+
(Pdb) continue
1721+
"""
1722+
17031723

17041724
@support.requires_subprocess()
17051725
class PdbTestCase(unittest.TestCase):

0 commit comments

Comments
 (0)