From 646aba657e9e77f39b253ff76a6faf679684fe4e Mon Sep 17 00:00:00 2001 From: Tian Gao Date: Fri, 14 Apr 2023 13:07:31 -0700 Subject: [PATCH] Add regression test for entering pdb in try/except* --- Lib/test/test_pdb.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 9ad9a1c52ac102..94b441720f258c 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -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-- + > (None)test_function()->None + (Pdb) continue + """ + @support.requires_subprocess() class PdbTestCase(unittest.TestCase):