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

Method do_up

IPython/core/debugger.py:1182–1246  ·  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 and ignored modules.

(self, arg)

Source from the content-addressed store, hash-verified

1180 return super().stop_here(frame)
1181
1182 def do_up(self, arg):
1183 """u(p) [count]
1184 Move the current frame count (default one) levels up in the
1185 stack trace (to an older frame).
1186
1187 Will skip hidden frames and ignored modules.
1188 """
1189 # modified version of upstream that skips
1190 # frames with __tracebackhide__ and ignored modules
1191 if self.curindex == 0:
1192 self.error("Oldest frame")
1193 return
1194 try:
1195 count = int(arg or 1)
1196 except ValueError:
1197 self.error("Invalid frame count (%s)" % arg)
1198 return
1199
1200 hidden_skipped = 0
1201 module_skipped = 0
1202
1203 if count < 0:
1204 _newframe = 0
1205 else:
1206 counter = 0
1207 hidden_frames = self.hidden_frames(self.stack)
1208
1209 for i in range(self.curindex - 1, -1, -1):
1210 should_skip_hidden = hidden_frames[i] and self.skip_hidden
1211 should_skip_module = self.skip and self.is_skipped_module(
1212 self.stack[i][0].f_globals.get("__name__", "")
1213 )
1214
1215 if should_skip_hidden or should_skip_module:
1216 if should_skip_hidden:
1217 hidden_skipped += 1
1218 if should_skip_module:
1219 module_skipped += 1
1220 continue
1221 counter += 1
1222 if counter >= count:
1223 break
1224 else:
1225 # if no break occurred.
1226 self.error(
1227 "all frames above skipped (hidden frames and ignored modules). Use `skip_hidden False` for hidden frames or unignore_module for ignored modules."
1228 )
1229 return
1230
1231 _newframe = i
1232 self._select_frame(_newframe)
1233
1234 total_skipped = hidden_skipped + module_skipped
1235 if total_skipped:
1236 print(
1237 self.theme.format(
1238 [
1239 (

Callers

nothing calls this directly

Calls 4

hidden_framesMethod · 0.95
errorMethod · 0.80
getMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected