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

R. David Murray report at bugs.python.org
Wed Mar 12 19:01:53 CET 2014


R. David Murray added the comment:

There is at least one other place (do_break) where this same problem could crop up.  Unittest handles this by having a 'safe_repr' function.  pdb doesn't need the same function unittest does, but it could do something similar, and then use %s and this function in the places where it currently uses repr to print an arbitrary object:

    def safe_repr(obj):
        try:
            return repr(obj)
        except Exception:
            return object.__repr__(obj)

----------

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


More information about the Python-bugs-list mailing list