[3.10] bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) (GH-27006)

(cherry picked from commit d968a638fc)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
This commit is contained in:
Irit Katriel 2021-07-03 17:28:46 +01:00 committed by GitHub
parent 0856134542
commit 33022f9e86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -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'''