gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547)

This commit is contained in:
Tian Gao 2023-04-14 13:40:31 -07:00 committed by GitHub
parent 3d71b5ec5e
commit 7c1b0a46c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 0 deletions

View File

@ -1700,6 +1700,26 @@ def test_pdb_issue_gh_103225():
(Pdb) continue
"""
def test_pdb_issue_gh_101517():
"""See GH-101517
Make sure pdb doesn't crash when the exception is caught in a try/except* block
>>> def test_function():
... try:
... raise KeyError
... except* Exception as e:
... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
>>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
... 'continue'
... ]):
... test_function()
--Return--
> <doctest test.test_pdb.test_pdb_issue_gh_101517[0]>(None)test_function()->None
(Pdb) continue
"""
@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):