[issue20853] pdb "args" crashes when an arg is not printable

Jurjen N.E. Bos report at bugs.python.org
Wed Mar 12 09:22:57 CET 2014


Jurjen N.E. Bos added the comment:

I am not good at this. Sorry for the mess.
Here is a good example, and a good patch:
>>> class foo:
...   def __init__(self):
...     foo.bar = "hello"
...   def __repr__(self): return foo.bar
...
>>> pdb.runcall(foo)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'pdb' is not defined
>>> import pdb
>>> pdb.runcall(foo)
> <stdin>(3)__init__()
(Pdb) a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python33\lib\pdb.py", line 1577, in runcall
    return Pdb().runcall(*args, **kwds)
  File "C:\Python33\lib\bdb.py", line 439, in runcall
    res = func(*args, **kwds)
  File "<stdin>", line 3, in __init__
  File "<stdin>", line 3, in __init__
  File "C:\Python33\lib\bdb.py", line 47, in trace_dispatch
    return self.dispatch_line(frame)
  File "C:\Python33\lib\bdb.py", line 65, in dispatch_line
    self.user_line(frame)
  File "C:\Python33\lib\pdb.py", line 266, in user_line
    self.interaction(frame, None)
  File "C:\Python33\lib\pdb.py", line 345, in interaction
    self._cmdloop()
  File "C:\Python33\lib\pdb.py", line 318, in _cmdloop
    self.cmdloop()
  File "C:\Python33\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "C:\Python33\lib\pdb.py", line 411, in onecmd
    return cmd.Cmd.onecmd(self, line)
  File "C:\Python33\lib\cmd.py", line 217, in onecmd
    return func(arg)
  File "C:\Python33\lib\pdb.py", line 1131, in do_args
    self.message('%s = %r' % (name, dict[name]))
  File "<stdin>", line 4, in __repr__
AttributeError: type object 'foo' has no attribute 'bar'

----------
Added file: http://bugs.python.org/file34370/pdb.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20853>
_______________________________________


More information about the Python-bugs-list mailing list