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

(cherry picked from commit d968a638fcbf9030c999cfacd4c9bf0656e779c4)

Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
diff --git a/Lib/pdb.py b/Lib/pdb.py
index ff40f7b..1b4ff54 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -1026,7 +1026,11 @@ def do_run(self, arg):
         if arg:
             import shlex
             argv0 = sys.argv[0:1]
-            sys.argv = shlex.split(arg)
+            try:
+                sys.argv = shlex.split(arg)
+            except ValueError as e:
+                self.error('Cannot run %s: %s' % (arg, e))
+                return
             sys.argv[:0] = argv0
         # this is caught in the main debugger loop
         raise Restart