Bugs item #1472251, was opened at 2006-04-18 12:16 Message generated for change (Comment added) made by jakamkon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1472251&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 6 Submitted By: Kuba KoÅczyk (jakamkon) Assigned to: Nobody/Anonymous (nobody) Summary: pdb 'run' crashes when the it's first argument is non-string Initial Comment: Pdb 'run/runeval' commands fails to check the type of given argument.When argument to 'run/runeval' is non-string the functions crashes with further impilications on (correctly)invoking this functions: Python 2.5a1 (trunk:45527, Apr 18 2006, 11:12:31) >>> def x(): pass >>> import pdb >>> pdb.run(x()) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/jkk/python/python-svn/Lib/pdb.py", line 1113, in run Pdb().run(statement, globals, locals) File "/home/jkk/python/python-svn/Lib/bdb.py", line 363, in run cmd = cmd+'\n' TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' >>> pdb.run('x()') > /home/jkk/python/python-svn/Lib/pdb.py(1113)run() -> Pdb().run(statement, globals, locals) (Pdb) # CTRL-D pressed Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/jkk/python/python-svn/Lib/pdb.py", line 1113, in run Pdb().run(statement, globals, locals) File "/home/jkk/python/python-svn/Lib/pdb.py", line 1113, in run Pdb().run(statement, globals, locals) File "/home/jkk/python/python-svn/Lib/bdb.py", line 48, in trace_dispatch return self.dispatch_line(frame) File "/home/jkk/python/python-svn/Lib/bdb.py", line 67, in dispatch_line if self.quitting: raise BdbQuit bdb.BdbQuit The solution is to simply ensure that the first argument passed to the 'run/runeval' functions is string. ---------------------------------------------------------------------- >Comment By: Kuba KoÅczyk (jakamkon) Date: 2006-05-22 09:20 Message: Logged In: YES user_id=1491175 The point is that when you want to invoke pdb.run correctly (with string argument) after getting TypeError as in above example, your namespace is probably overwritten or deleted so that you don't have access to previously defined symbols. >>> def x():pass >>> import pdb >>> pdb.run(x()) TypeError >>> pdb.run('x()') > /home/jkk/python-svn/Lib/pdb.py(1122)run() -> Pdb().run(statement, globals, locals) (Pdb) pdb *** NameError: name 'pdb' is not defined (Pdb) x *** NameError: name 'x' is not defined ---------------------------------------------------------------------- Comment By: Ilya Sandler (isandler) Date: 2006-05-21 23:25 Message: Logged In: YES user_id=971153 I would not classify your example as a crash. You passed a wrong value (None in your case) into pdb.run() and got back a TypeError...Isn't it an expected response? E.g if you do: >>>max(13) You'll also get: "TypeError" Am I missing something? Could you clarify? ---------------------------------------------------------------------- Comment By: Kuba KoÅczyk (jakamkon) Date: 2006-04-18 12:36 Message: Logged In: YES user_id=1491175 Patch is in #1472257 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1472251&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com