This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bad behavior with "restart \" or "restart "" in pdb
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: iritkatriel, j-rewerts, miss-islington, ppperry
Priority: normal Keywords: patch

Created on 2018-07-28 23:24 by ppperry, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26656 merged iritkatriel, 2021-06-10 21:50
PR 27005 merged miss-islington, 2021-07-03 15:33
PR 27006 merged iritkatriel, 2021-07-03 15:44
Messages (10)
msg322595 - (view) Author: (ppperry) Date: 2018-07-28 23:24
(Pdb) restart \
Traceback (most recent call last):
  File "C:\Program Files\Python36\lib\pdb.py", line 1667, in main
    pdb._runscript(mainpyfile)
  File "C:\Program Files\Python36\lib\pdb.py", line 1548, in _runscript
    self.run(statement)
  File "C:\Program Files\Python36\lib\bdb.py", line 431, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  <code being debugged ommited>
  File "C:\Program Files\Python36\lib\bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "C:\Program Files\Python36\lib\bdb.py", line 66, in dispatch_line
    self.user_line(frame)
  File "C:\Program Files\Python36\lib\pdb.py", line 261, in user_line
    self.interaction(frame, None)
  File "C:\Program Files\Python36\lib\pdb.py", line 352, in interaction
    self._cmdloop()
  File "C:\Program Files\Python36\lib\pdb.py", line 321, in _cmdloop
    self.cmdloop()
  File "C:\Program Files\Python36\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "C:\Program Files\Python36\lib\pdb.py", line 418, in onecmd
    return cmd.Cmd.onecmd(self, line)
  File "C:\Program Files\Python36\lib\cmd.py", line 217, in onecmd
    return func(arg)
  File "C:\Program Files\Python36\lib\pdb.py", line 1025, in do_run
    sys.argv = shlex.split(arg)
  File "C:\Program Files\Python36\lib\shlex.py", line 305, in split
    return list(lex)
  File "C:\Program Files\Python36\lib\shlex.py", line 295, in __next__
    token = self.get_token()
  File "C:\Program Files\Python36\lib\shlex.py", line 105, in get_token
    raw = self.read_token()
  File "C:\Program Files\Python36\lib\shlex.py", line 206, in read_token
    raise ValueError("No escaped character")
msg322596 - (view) Author: (ppperry) Date: 2018-07-28 23:26
Just to be clear, even though the traceback is python 3.6, the same bug occurs in 3.7 with an identical traceback except for some changes in line number
msg322600 - (view) Author: Jared (j-rewerts) * Date: 2018-07-29 01:30
I wouldn't mind taking a look at this. Feel free to assign it to me!
msg322601 - (view) Author: (ppperry) Date: 2018-07-29 01:37
`restart "` also crashes with the same tb
msg322602 - (view) Author: Jared (j-rewerts) * Date: 2018-07-29 02:34
Would it be possible to escape both of those?

For the first one, restart "\\"

and for the second one, restart "\""
msg322603 - (view) Author: (ppperry) Date: 2018-07-29 02:37
Both of those work and don't produce an error
msg322604 - (view) Author: Jared (j-rewerts) * Date: 2018-07-29 02:46
Good!

Is it possible to start a python program with either \ or " as arguments normally (without using character escaping)?
msg396911 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-07-03 15:33
New changeset d968a638fcbf9030c999cfacd4c9bf0656e779c4 by Irit Katriel in branch 'main':
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656)
https://github.com/python/cpython/commit/d968a638fcbf9030c999cfacd4c9bf0656e779c4
msg396912 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-07-03 16:05
New changeset 21be6cb0304ba143980b7e4c875cb5b9db30952b by Miss Islington (bot) in branch '3.9':
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) (GH-27005)
https://github.com/python/cpython/commit/21be6cb0304ba143980b7e4c875cb5b9db30952b
msg396913 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-07-03 16:28
New changeset 33022f9e86878c84c605de27aae4bd782ecb8da6 by Irit Katriel in branch '3.10':
[3.10] bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) (GH-27006)
https://github.com/python/cpython/commit/33022f9e86878c84c605de27aae4bd782ecb8da6
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78447
2021-07-03 16:29:03iritkatrielsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-07-03 16:28:54iritkatrielsetmessages: + msg396913
2021-07-03 16:05:55iritkatrielsetmessages: + msg396912
2021-07-03 15:47:07iritkatrielsetversions: + Python 3.9, Python 3.10, Python 3.11, - Python 3.6, Python 3.7, Python 3.8
2021-07-03 15:44:12iritkatrielsetpull_requests: + pull_request25566
2021-07-03 15:33:50miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request25565
2021-07-03 15:33:44iritkatrielsetmessages: + msg396911
2021-06-10 21:50:37iritkatrielsetkeywords: + patch
nosy: + iritkatriel

pull_requests: + pull_request25242
stage: patch review
2018-07-29 02:46:15j-rewertssetmessages: + msg322604
2018-07-29 02:37:03ppperrysetmessages: + msg322603
2018-07-29 02:34:27j-rewertssetmessages: + msg322602
2018-07-29 01:37:58ppperrysetmessages: + msg322601
title: Bad behavior with "restart \" in pdb -> Bad behavior with "restart \" or "restart "" in pdb
2018-07-29 01:30:53j-rewertssetnosy: + j-rewerts
messages: + msg322600
2018-07-28 23:26:28ppperrysetmessages: + msg322596
2018-07-28 23:24:25ppperrycreate