]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547)
authorTian Gao <gaogaotiantian@hotmail.com>
Fri, 14 Apr 2023 20:40:31 +0000 (13:40 -0700)
committerGitHub <noreply@github.com>
Fri, 14 Apr 2023 20:40:31 +0000 (21:40 +0100)
Lib/test/test_pdb.py

index 9ad9a1c52ac102334d1579288d79aa3f8716bc61..94b441720f258cc416baa9e7d176e6c221134167 100644 (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):