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

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


Jurjen N.E. Bos added the comment:

Oops. Here the correct example:
>>> class foo:
...   def __init__(self):
...     foo.bar = "hello"
...   def __repr__(self): return foo.bar
...
>>> pdb.runcall(foo)
> <stdin>(3)__init__()
(Pdb) a
Traceback (most recent call last):
  File ".\pdb.py", line 1132, in do_args
    self.message('%s = %r' % (name, dict[name]))
  File "<stdin>", line 4, in __repr__
AttributeError: type object 'foo' has no attribute 'bar'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".\pdb.py", line 1580, 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 ".\pdb.py", line 266, in user_line
    self.interaction(frame, None)
  File ".\pdb.py", line 345, in interaction
    self._cmdloop()
  File ".\pdb.py", line 318, in _cmdloop
    self.cmdloop()
  File "C:\Python33\lib\cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File ".\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 ".\pdb.py", line 1134, in do_args
    self.message('%s = *** repr failed: %s ***' % (name,))
TypeError: not enough arguments for format string

At least, I expect pdb to not crash, but a clearer error (as in the patch) is nice to have.

----------

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


More information about the Python-bugs-list mailing list