summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2023-10-15 10:55:00 (GMT)
committerGitHub <noreply@github.com>2023-10-15 10:55:00 (GMT)
commitfa18b0afe47615dbda15407a102b84e40cadf6a5 (patch)
tree23b203670098ab160fa4511157d9e1852cdae2e8 /Lib/test
parent84b7e9e3fa67fb9b92088d17839d8235f1cec62e (diff)
downloadcpython-fa18b0afe47615dbda15407a102b84e40cadf6a5.zip
cpython-fa18b0afe47615dbda15407a102b84e40cadf6a5.tar.gz
cpython-fa18b0afe47615dbda15407a102b84e40cadf6a5.tar.bz2
gh-84583: Make pdb enter post-mortem mode even for SyntaxError (#110883)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pdb.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index ff677ae..a668b6c 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -2638,13 +2638,28 @@ def bœr():
commands = ''
expected = "SyntaxError:"
stdout, stderr = self.run_pdb_script(
- script, commands, expected_returncode=1
+ script, commands
)
self.assertIn(expected, stdout,
'\n\nExpected:\n{}\nGot:\n{}\n'
'Fail to handle a syntax error in the debuggee.'
.format(expected, stdout))
+ def test_issue84583(self):
+ # A syntax error from ast.literal_eval should not make pdb exit.
+ script = "import ast; ast.literal_eval('')\n"
+ commands = """
+ continue
+ where
+ quit
+ """
+ stdout, stderr = self.run_pdb_script(script, commands)
+ # The code should appear 3 times in the stdout:
+ # 1. when pdb starts
+ # 2. when the exception is raised, in trackback
+ # 3. in where command
+ self.assertEqual(stdout.count("ast.literal_eval('')"), 3)
+
def test_issue26053(self):
# run command of pdb prompt echoes the correct args
script = "print('hello')"