MCPcopy Index your code
hub / github.com/python/cpython / dispatch_exception

Method dispatch_exception

Lib/bdb.py:374–401  ·  view source on GitHub ↗

Invoke user function and return trace function for exception event. If the debugger stops on this exception, invoke self.user_exception(). Raise BdbQuit if self.quitting is set. Return self.trace_dispatch to continue tracing in this scope.

(self, frame, arg)

Source from the content-addressed store, hash-verified

372 return self.trace_dispatch
373
374 def dispatch_exception(self, frame, arg):
375 """Invoke user function and return trace function for exception event.
376
377 If the debugger stops on this exception, invoke
378 self.user_exception(). Raise BdbQuit if self.quitting is set.
379 Return self.trace_dispatch to continue tracing in this scope.
380 """
381 if self.stop_here(frame):
382 # When stepping with next/until/return in a generator frame, skip
383 # the internal StopIteration exception (with no traceback)
384 # triggered by a subiterator run with the 'yield from' statement.
385 if not (frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS
386 and arg[0] is StopIteration and arg[2] is None):
387 self.user_exception(frame, arg)
388 self.restart_events()
389 if self.quitting: raise BdbQuit
390 # Stop at the StopIteration or GeneratorExit exception when the user
391 # has set stopframe in a generator by issuing a return command, or a
392 # next/until command at the last statement in the generator before the
393 # exception.
394 elif (self.stopframe and frame is not self.stopframe
395 and self.stopframe.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS
396 and arg[0] in (StopIteration, GeneratorExit)):
397 self.user_exception(frame, arg)
398 self.restart_events()
399 if self.quitting: raise BdbQuit
400
401 return self.trace_dispatch
402
403 def dispatch_opcode(self, frame, arg):
404 """Invoke user function and return trace function for opcode event.

Callers 1

trace_dispatchMethod · 0.95

Calls 3

stop_hereMethod · 0.95
user_exceptionMethod · 0.95
restart_eventsMethod · 0.95

Tested by

no test coverage detected