summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-04-14 20:40:31 (GMT)
committerGitHub <noreply@github.com>2023-04-14 20:40:31 (GMT)
commit7c1b0a46c61f8bf8e2039bba1bff11b6ae20e56b (patch)
tree357b47c04fde60ef8ee565734d51bc7485ad2c8c /Lib/test/test_pdb.py
parent3d71b5ec5ecccc14c00707d73ebbc907877b3448 (diff)
downloadcpython-7c1b0a46c61f8bf8e2039bba1bff11b6ae20e56b.zip
cpython-7c1b0a46c61f8bf8e2039bba1bff11b6ae20e56b.tar.gz
cpython-7c1b0a46c61f8bf8e2039bba1bff11b6ae20e56b.tar.bz2
gh-101517: Add regression test for a lineno bug in try/except* impacting pdb (#103547)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 9ad9a1c..94b4417 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--
+ > <doctest test.test_pdb.test_pdb_issue_gh_101517[0]>(None)test_function()->None
+ (Pdb) continue
+ """
+
@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):