MCPcopy Create free account
hub / github.com/ipython/ipython / do_up

Method do_up

IPython/core/debugger.py:686–730  ·  view source on GitHub ↗

u(p) [count] Move the current frame count (default one) levels up in the stack trace (to an older frame). Will skip hidden frames.

(self, arg)

Source from the content-addressed store, hash-verified

684 return True
685
686 def do_up(self, arg):
687 """u(p) [count]
688 Move the current frame count (default one) levels up in the
689 stack trace (to an older frame).
690
691 Will skip hidden frames.
692 """
693 ## modified version of upstream that skips
694 # frames with __tracebackide__
695 if self.curindex == 0:
696 self.error("Oldest frame")
697 return
698 try:
699 count = int(arg or 1)
700 except ValueError:
701 self.error("Invalid frame count (%s)" % arg)
702 return
703 skipped = 0
704 if count < 0:
705 _newframe = 0
706 else:
707 _newindex = self.curindex
708 counter = 0
709 hidden_frames = self.hidden_frames(self.stack)
710 for i in range(self.curindex - 1, -1, -1):
711 frame = self.stack[i][0]
712 if hidden_frames[i] and self.skip_hidden:
713 skipped += 1
714 continue
715 counter += 1
716 if counter >= count:
717 break
718 else:
719 # if no break occured.
720 self.error("all frames above hidden")
721 return
722
723 Colors = self.color_scheme_table.active_colors
724 ColorsNormal = Colors.Normal
725 _newframe = i
726 self._select_frame(_newframe)
727 if skipped:
728 print(
729 f"{Colors.excName} [... skipped {skipped} hidden frame(s)]{ColorsNormal}\n"
730 )
731
732 def do_down(self, arg):
733 """d(own) [count]

Callers

nothing calls this directly

Calls 2

hidden_framesMethod · 0.95
errorMethod · 0.80

Tested by

no test coverage detected