summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-06-23 14:19:13 (GMT)
committerGitHub <noreply@github.com>2022-06-23 14:19:13 (GMT)
commit5b6e5762ca2f758330d2708c63e301720cf3dfae (patch)
treea079a828b7d90f5ef8161f1af4e8069424288eb4 /Lib/test/test_pdb.py
parent89285314bdbd067922d5eb02efd76da07e6fce4e (diff)
downloadcpython-5b6e5762ca2f758330d2708c63e301720cf3dfae.zip
cpython-5b6e5762ca2f758330d2708c63e301720cf3dfae.tar.gz
cpython-5b6e5762ca2f758330d2708c63e301720cf3dfae.tar.bz2
GH-91742: Fix pdb crash after jump (GH-94171)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 0141b73..f0c15e7 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1363,7 +1363,50 @@ def test_pdb_issue_43318():
4
"""
+def test_pdb_issue_gh_91742():
+ """See GH-91742
+ >>> def test_function():
+ ... __author__ = "pi"
+ ... __version__ = "3.14"
+ ...
+ ... def about():
+ ... '''About'''
+ ... print(f"Author: {__author__!r}",
+ ... f"Version: {__version__!r}",
+ ... sep=" ")
+ ...
+ ... import pdb; pdb.Pdb(nosigint=True, readrc=False).set_trace()
+ ... about()
+
+
+ >>> reset_Breakpoint()
+ >>> with PdbTestInput([ # doctest: +NORMALIZE_WHITESPACE
+ ... 'step',
+ ... 'next',
+ ... 'next',
+ ... 'jump 5',
+ ... 'continue'
+ ... ]):
+ ... test_function()
+ > <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(12)test_function()
+ -> about()
+ (Pdb) step
+ --Call--
+ > <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
+ -> def about():
+ (Pdb) next
+ > <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(7)about()
+ -> print(f"Author: {__author__!r}",
+ (Pdb) next
+ > <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(8)about()
+ -> f"Version: {__version__!r}",
+ (Pdb) jump 5
+ > <doctest test.test_pdb.test_pdb_issue_gh_91742[0]>(5)about()
+ -> def about():
+ (Pdb) continue
+ Author: 'pi' Version: '3.14'
+ """
@support.requires_subprocess()
class PdbTestCase(unittest.TestCase):
def tearDown(self):