MCPcopy Index your code
hub / github.com/ipython/ipython / print_stack_trace

Method print_stack_trace

IPython/core/debugger.py:587–622  ·  view source on GitHub ↗
(self, context: int | None = None)

Source from the content-addressed store, hash-verified

585 do_q = do_quit = decorate_fn_with_doc(new_do_quit, OldPdb.do_quit)
586
587 def print_stack_trace(self, context: int | None = None):
588 if context is None:
589 context = self.context
590 try:
591 skipped = 0
592 to_print = ""
593 for hidden, frame_lineno in zip(self.hidden_frames(self.stack), self.stack):
594 if hidden and self.skip_hidden:
595 skipped += 1
596 continue
597 if skipped:
598 to_print += self.theme.format(
599 [
600 (
601 Token.ExcName,
602 f" [... skipping {skipped} hidden frame(s)]",
603 ),
604 (Token, "\n"),
605 ]
606 )
607
608 skipped = 0
609 to_print += self.format_stack_entry(frame_lineno)
610 if skipped:
611 to_print += self.theme.format(
612 [
613 (
614 Token.ExcName,
615 f" [... skipping {skipped} hidden frame(s)]",
616 ),
617 (Token, "\n"),
618 ]
619 )
620 print(to_print, file=self.stdout)
621 except KeyboardInterrupt:
622 pass
623
624 def print_stack_entry(
625 self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = "\n-> "

Callers 1

do_whereMethod · 0.95

Calls 3

hidden_framesMethod · 0.95
format_stack_entryMethod · 0.95
formatMethod · 0.45

Tested by

no test coverage detected