From: Tian Gao Date: Fri, 14 Apr 2023 20:40:31 +0000 (-0700) Subject: gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547) X-Git-Tag: v3.12.0b1~531 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c1b0a46c61f8bf8e2039bba1bff11b6ae20e56b;p=thirdparty%2FPython%2Fcpython.git gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547) --- diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 9ad9a1c52ac1..94b441720f25 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):