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: pdb "commands" command throws you into postmortem if you enter an empty command
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Alexander.Belopolsky, georg.brandl, isandler
Priority: normal Keywords: patch

Created on 2010-02-24 17:53 by isandler, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue8015.diff Alexander.Belopolsky, 2010-02-25 23:33 Patch against revision 78430
Messages (3)
msg100057 - (view) Author: Ilya Sandler (isandler) Date: 2010-02-24 17:53
Here is a sample session:

 cheetah:~/comp/python/trunk>  ./python ./Lib/pdb.py hello
 > /home/ilya/comp/python/trunk/hello(1)<module>()
 -> print i
 (Pdb) b 1
 Breakpoint 1 at /home/ilya/comp/python/trunk/hello:1
 (Pdb) commands 1
 (com) 
 Traceback (most recent call last):
    self.cmdloop()
  File "/home/ilya/comp/python/trunk/Lib/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 273, in onecmd
    return cmd.Cmd.onecmd(self, line)
  File "/home/ilya/comp/python/trunk/Lib/cmd.py", line 219, in onecmd
    return func(arg)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 330, in    do_commands
    self.cmdloop()
  File "/home/ilya/comp/python/trunk/Lib/cmd.py", line 142, in cmdloop
    stop = self.onecm  File "/home/ilya/comp/python/trunk/Lib/bdb.py", line 66, in  dispatch_line
    self.user_line(frame)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 158, in user_line
    self.interaction(frame, None)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 206, in interaction
d(line)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 275, in onecmd
    return self.handle_command_def(line)
  File "/home/ilya/comp/python/trunk/Lib/pdb.py", line 293, in handle_command_def
    func = getattr(self, 'do_' + cmd)
 TypeError: cannot concatenate 'str' and 'NoneType' objects
 Uncaught exception. Entering post mortem debugging
 Running 'cont' or 'step' will restart the program
 > /home/ilya/comp/python/trunk/Lib/pdb.py(293)handle_command_def()
 -> func = getattr(self, 'do_' + cmd)
msg100127 - (view) Author: Alexander Belopolsky (Alexander.Belopolsky) Date: 2010-02-25 23:33
I am attaching the patch that fixes the issue by ignoring empty and all space lines during commands' entry.  Note that as written the patch also makes pdb ignore shell escapes unless it is extended with do_shell method. I think this is the right behavior.
msg112050 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-30 08:54
Fixed in r83265. Thanks!
History
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52263
2010-07-30 08:54:59georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg112050

resolution: fixed
2010-02-25 23:33:59Alexander.Belopolskysetfiles: + issue8015.diff

type: behavior
components: + Library (Lib)

keywords: + patch
nosy: + Alexander.Belopolsky
messages: + msg100127
2010-02-24 17:53:22isandlercreate