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)
| 160 | return self.trace_dispatch |
| 161 | |
| 162 | def dispatch_exception(self, frame, arg): |
| 163 | """Invoke user function and return trace function for exception event. |
| 164 | |
| 165 | If the debugger stops on this exception, invoke |
| 166 | self.user_exception(). Raise BdbQuit if self.quitting is set. |
| 167 | Return self.trace_dispatch to continue tracing in this scope. |
| 168 | """ |
| 169 | if self.stop_here(frame): |
| 170 | # When stepping with next/until/return in a generator frame, skip |
| 171 | # the internal StopIteration exception (with no traceback) |
| 172 | # triggered by a subiterator run with the 'yield from' statement. |
| 173 | if not (frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS |
| 174 | and arg[0] is StopIteration and arg[2] is None): |
| 175 | self.user_exception(frame, arg) |
| 176 | if self.quitting: raise BdbQuit |
| 177 | # Stop at the StopIteration or GeneratorExit exception when the user |
| 178 | # has set stopframe in a generator by issuing a return command, or a |
| 179 | # next/until command at the last statement in the generator before the |
| 180 | # exception. |
| 181 | elif (self.stopframe and frame is not self.stopframe |
| 182 | and self.stopframe.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS |
| 183 | and arg[0] in (StopIteration, GeneratorExit)): |
| 184 | self.user_exception(frame, arg) |
| 185 | if self.quitting: raise BdbQuit |
| 186 | |
| 187 | return self.trace_dispatch |
| 188 | |
| 189 | # Normally derived classes don't override the following |
| 190 | # methods, but they may if they want to redefine the |
no test coverage detected