summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-07-03 15:33:35 (GMT)
committerGitHub <noreply@github.com>2021-07-03 15:33:35 (GMT)
commitd968a638fcbf9030c999cfacd4c9bf0656e779c4 (patch)
tree28ba4651a7a3c0b9b4396b19144ac8aacde8c9fa /Lib/test/test_pdb.py
parent556d5ad11fb380868c19beeba53d49f89c27f32d (diff)
downloadcpython-d968a638fcbf9030c999cfacd4c9bf0656e779c4.zip
cpython-d968a638fcbf9030c999cfacd4c9bf0656e779c4.tar.gz
cpython-d968a638fcbf9030c999cfacd4c9bf0656e779c4.tar.bz2
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656)
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 0724b66..63afb81 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1800,6 +1800,21 @@ def bœr():
'(Pdb) ',
])
+ def test_issue34266(self):
+ '''do_run handles exceptions from parsing its arg'''
+ def check(bad_arg, msg):
+ commands = "\n".join([
+ f'run {bad_arg}',
+ 'q',
+ ])
+ stdout, _ = self.run_pdb_script('pass', commands + '\n')
+ self.assertEqual(stdout.splitlines()[1:], [
+ '-> pass',
+ f'(Pdb) *** Cannot run {bad_arg}: {msg}',
+ '(Pdb) ',
+ ])
+ check('\\', 'No escaped character')
+ check('"', 'No closing quotation')
def test_issue42384(self):
'''When running `python foo.py` sys.path[0] is an absolute path. `python -m pdb foo.py` should behave the same'''