ipdb icon indicating copy to clipboard operation
ipdb copied to clipboard

heads-up : Change in IPython behavior.

Open Carreau opened this issue 5 years ago • 3 comments

in https://github.com/ipython/ipython/pull/12359 I'll change IPtyhon default behavior to skip hidden frames with a toggle. Not sure if you want to expose this in some way with ipdb

Carreau avatar Jun 05 '20 00:06 Carreau

I quickly went through ipython/ipython#12359. I do not understand the goal. Would you mind to expand ?

gotcha avatar Jun 15 '20 13:06 gotcha

Here is an example.

In [1]: from IPython.terminal.debugger import set_trace
   ...:
   ...: def g():
   ...:     import ipdb
   ...:     set_trace()
   ...:     raise ValueError
   ...:
   ...: def f(n):
   ...:
   ...:     __tracebackhide__ = True
   ...:     if n < 0:
   ...:         g()
   ...:     else:
   ...:         f(n-1)
   ...:
   ...: def a():
   ...:     f(5)
   ...: a()
> <ipython-input-1-2b5dbc49c3e4>(6)g()
      4     import ipdb
      5     set_trace()
----> 6     raise ValueError
      7
      8 def f(n):

ipdb> w
    [... skipping 12 hidden frame(s)]

  <ipython-input-1-2b5dbc49c3e4>(18)<module>()
     14         f(n-1)
     15
     16 def a():
     17     f(5)
---> 18 a()

  <ipython-input-1-2b5dbc49c3e4>(17)a()
     14         f(n-1)
     15
     16 def a():
---> 17     f(5)
     18 a()

    [... skipping 7 hidden frame(s)]

> <ipython-input-1-2b5dbc49c3e4>(6)g()
      4     import ipdb
      5     set_trace()
----> 6     raise ValueError
      7
      8 def f(n):

See the [skipping N hidden frames.].

Carreau avatar Jun 15 '20 16:06 Carreau

I had understood that the mean was to hide frames. What is not obvious to me is why you would want to hide them ?

gotcha avatar Jun 16 '20 07:06 gotcha

I am having an issue and the hidden frames are preventing me from debugging my code. How can I disable this behavior and go back to showing all frames by default?

ecotner avatar Aug 30 '23 00:08 ecotner

ipdb> help

Documented commands (type help <topic>):
========================================
EOF    commands   enable      ll        pp       s                until
...    ...        ...         ...       ...      skip_hidden      ...
...    ...        ...         ...       ...      skip_predicates  ...

Miscellaneous help topics:
==========================
exec  pdb

Undocumented commands:
======================
interact

ipdb> skip_hidden false

And you should be good to go.

You can tweak individual skip rules, or add your own:

ipdb> skip_predicates
current predicates:
    tbhide : True
    readonly : False
    ipython_internal : True
    debuggerskip : True
ipdb> skip_predicates tbhide false
ipdb> skip_predicates
current predicates:
    tbhide : False
    readonly : False
    ipython_internal : True
    debuggerskip : True

Carreau avatar Aug 30 '23 07:08 Carreau

I think we can close this one as this was just a FYI

Carreau avatar Nov 06 '23 18:11 Carreau