summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2015-09-05 23:13:26 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2015-09-05 23:13:26 (GMT)
commitca3f435fe6b5de970848eb3a5d8f8e6cd5d2f73c (patch)
treeaf703be82111b458922d8376f9189fde9ae4c729 /Lib/test/test_pdb.py
parent6fb5bae252b90b81dff19f572fe40a9051e5e51d (diff)
downloadcpython-ca3f435fe6b5de970848eb3a5d8f8e6cd5d2f73c.zip
cpython-ca3f435fe6b5de970848eb3a5d8f8e6cd5d2f73c.tar.gz
cpython-ca3f435fe6b5de970848eb3a5d8f8e6cd5d2f73c.tar.bz2
Issue #16180: Exit pdb if file has syntax error, instead of trapping user
in an infinite loop. Patch by Xavier de Gaye.
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index ec8346c..35044ad 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1043,6 +1043,18 @@ class PdbTestCase(unittest.TestCase):
self.assertNotIn('Error', stdout.decode(),
"Got an error running test script under PDB")
+ def test_issue16180(self):
+ # A syntax error in the debuggee.
+ script = "def f: pass\n"
+ commands = ''
+ expected = "SyntaxError:"
+ stdout, stderr = self.run_pdb(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 tearDown(self):
support.unlink(support.TESTFN)