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

2021-09-16 Thread Andrei Kulakov
Andrei Kulakov added the comment: p/pp commands were fixed in this commit: https://github.com/python/cpython/commit/6544b2532df -- ___ Python tracker ___

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

2021-09-16 Thread Andrei Kulakov
Change by Andrei Kulakov : -- nosy: +andrei.avk nosy_count: 3.0 -> 4.0 pull_requests: +26814 pull_request: https://github.com/python/cpython/pull/28400 ___ Python tracker ___

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

2014-05-23 Thread Xavier de Gaye
Xavier de Gaye added the comment: Commands that silently fail when an object is not printable: p, pp Commands that crash when an object is not printable: args, retval Python 3: display Python 2: on a 'return' trace event when the return value is not printable The attached script

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

2014-05-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20853 ___ ___

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

2014-03-18 Thread Xavier de Gaye
Xavier de Gaye added the comment: There is at least one other place (do_break) where this same problem could crop up. Also in do_retval. And the exception is silently ignored in do_p and do_pp when repr() fails, which is not correct. A solution could be to have a message_safe method to be

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

2014-03-17 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: I did figure it out. It almost works, except when a argument lost its value, and the same name exists in the global context. To be more specific: I simplified do_args to the following code (that obviously ugly by explicitly evaluating repr in context, but that

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

2014-03-14 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: Maybe we could use Pdb._getval_except(arg, frame=None) in the routine do_args. If I understand the code, do_args does quite some work to get the value of name in the context of the current frame, maybe just calling self._getval_except(name,

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

2014-03-12 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: Thanks for your reaction. The object is not printable, since I was debugging an __init__ of an object, and some fields where being initialized: class foo: def __init__(self): foo.bar = hello def repr(self): return foo.bar I tried to make a useable

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

2014-03-12 Thread Jurjen N.E. Bos
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

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

2014-03-12 Thread Jurjen N.E. Bos
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,

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

2014-03-12 Thread R. David Murray
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

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

2014-03-05 Thread Jurjen N.E. Bos
New submission from Jurjen N.E. Bos: The args command in pdb crashes when an argument cannot be printed. Fortunately, this is easy to fix. For version 3.3.3: In function Pdb.do_args (lib/pdb.py, line 1120) Change line 1131 self.message('%s = %r' % (name, dict[name])) to try: r =

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

2014-03-05 Thread R. David Murray
R. David Murray added the comment: Why is the object not printable? Can you provide a reproducer? Also, the bare except is buggy, it would catch things like KeyboardInterrupt that should not be caught there. 'except Exception' would be appropriate in this case. -- nosy: