diff -r 61566f35ab22 -r c878e8255972 eric6/DebugClients/Python/DebugBase.py --- a/eric6/DebugClients/Python/DebugBase.py Mon Jun 22 17:55:06 2020 +0200 +++ b/eric6/DebugClients/Python/DebugBase.py Tue Jun 23 17:24:18 2020 +0200 @@ -18,14 +18,8 @@ from BreakpointWatch import Breakpoint, Watch -if sys.version_info[0] == 2: - import thread as _thread - from inspect import getargvalues, formatargvalues -else: - import _thread - from DebugUtilities import getargvalues, formatargvalues - unicode = str - basestring = str +import _thread +from DebugUtilities import getargvalues, formatargvalues gRecursionLimit = 64 @@ -383,10 +377,7 @@ if frame is None: frame = sys._getframe().f_back # Skip set_trace method - if sys.version_info[0] == 2: - stopOnHandleCommand = self._dbgClient.handleJsonCommand.func_code - else: - stopOnHandleCommand = self._dbgClient.handleJsonCommand.__code__ + stopOnHandleCommand = self._dbgClient.handleJsonCommand.__code__ frame.f_trace = self.trace_dispatch while frame.f_back is not None: @@ -621,10 +612,7 @@ lineNo = frame.f_code.co_firstlineno lineNumbers = [lineNo] - if sys.version_info[0] == 2: - co_lnotab = map(ord, frame.f_code.co_lnotab[1::2]) - else: - co_lnotab = frame.f_code.co_lnotab[1::2] + co_lnotab = frame.f_code.co_lnotab[1::2] # No need to handle special case if a lot of lines between # (e.g. closure), because the additional lines won't cause a bp @@ -870,13 +858,7 @@ else: exctypetxt = str(exctype) - if sys.version_info[0] == 2: - try: - excvaltxt = unicode(excval).encode(self._dbgClient.getCoding()) - except UnicodeError: - excvaltxt = str(excval) - else: - excvaltxt = str(excval) + excvaltxt = str(excval) # Don't step into libraries, which are used by our debugger methods if exctb is not None: @@ -920,14 +902,7 @@ @param exctype type of the exception @return exception name (string) """ - if sys.version_info[0] == 2: - if type(exctype) in [types.ClassType, # Python up to 2.4 - types.TypeType]: # Python 2.5+ - return exctype.__name__ - else: - return exctype - else: - return str(exctype).replace("<class '", "").replace("'>", "") + return str(exctype).replace("<class '", "").replace("'>", "") def __extract_stack(self, exctb): """ @@ -957,7 +932,7 @@ if excval is None: exitcode = 0 message = "" - elif isinstance(excval, basestring): + elif isinstance(excval, str): exitcode = 1 message = excval elif isinstance(excval, bytes): @@ -968,7 +943,7 @@ message = "" elif isinstance(excval, SystemExit): code = excval.code - if isinstance(code, basestring): + if isinstance(code, str): exitcode = 1 message = code elif isinstance(code, bytes):