--- a/DebugClients/Python3/DebugBase.py Fri Sep 02 19:08:02 2016 +0200 +++ b/DebugClients/Python3/DebugBase.py Sat Sep 03 18:01:19 2016 +0200 @@ -199,6 +199,7 @@ if not self.__skip_it(fromFrame) and not self.__skip_it(toFrame): if event in ["call", "return"]: fr = fromFrame + # TODO: change from and to info to a dictionary fromStr = "{0}:{1}:{2}".format( self._dbgClient.absPath(self.fix_frame_filename(fr)), fr.f_lineno, @@ -306,6 +307,7 @@ self.user_exception(frame, arg) if self.quitting: raise bdb.BdbQuit + # Stop at the StopIteration or GeneratorExit exception when the user # has set stopframe in a generator by issuing a return command, or a # next/until command at the last statement in the generator before the @@ -523,7 +525,7 @@ # name. lineno = frame.f_code.co_firstlineno if lineno in self.breaks[filename]: - # flag says ok to delete temp. bp + # flag says ok to delete temp. breakpoint (bp, flag) = bdb.effective(filename, lineno, frame) if bp: self.currentbp = bp.number @@ -532,7 +534,7 @@ return True if "Watch" in self.breaks: - # flag says ok to delete temp. bp + # flag says ok to delete temp. watch (bp, flag) = self.__effective(frame) if bp: self.currentbp = bp.number @@ -707,18 +709,35 @@ if exctype in [SystemExit, bdb.BdbQuit]: atexit._run_exitfuncs() if excval is None: - excval = 0 + exitcode = 0 message = "" elif isinstance(excval, str): - excval = 1 + exitcode = 1 message = excval elif isinstance(excval, bytes): - excval = 1 + exitcode = 1 message = excval.decode() - if isinstance(excval, int): - self._dbgClient.progTerminated(excval, message) + elif isinstance(excval, int): + exitcode = excval + message = "" + elif isinstance(excval, SystemExit): + code = excval.code + if isinstance(code, str): + exitcode = 1 + message = code + elif isinstance(code, bytes): + exitcode = 1 + message = code.decode() + elif isinstance(code, int): + exitcode = code + message = "" + else: + exitcode = 1 + message = str(code) else: - self._dbgClient.progTerminated(excval.code, "") + exitcode = 1 + message = str(excval) + self._dbgClient.progTerminated(exitcode, message) return if exctype in [SyntaxError, IndentationError]: