eric6/DebugClients/Python/DebugBase.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8043
0acf98cd089a
parent 8257
28146736bbfc
diff -r fb0ef164f536 -r 698ae46f40a4 eric6/DebugClients/Python/DebugBase.py
--- a/eric6/DebugClients/Python/DebugBase.py	Fri Apr 02 11:59:41 2021 +0200
+++ b/eric6/DebugClients/Python/DebugBase.py	Sat May 01 14:27:20 2021 +0200
@@ -15,6 +15,7 @@
 import ctypes
 import time
 import dis
+import contextlib
 
 from BreakpointWatch import Breakpoint, Watch
 
@@ -53,7 +54,7 @@
     gRecursionLimit = limit
 
 
-class DebugBase(object):
+class DebugBase:
     """
     Class implementing base class of the debugger.
 
@@ -168,13 +169,11 @@
             cf = cf.f_back
             frmnr -= 1
         
-        try:
+        with contextlib.suppress(Exception):
             if "__pypy__" in sys.builtin_module_names:
                 import __pypy__
                 __pypy__.locals_to_fast(cf)
                 return
-        except Exception:       # secok
-            pass
         
         ctypes.pythonapi.PyFrame_LocalsToFast(
             ctypes.py_object(cf),
@@ -334,9 +333,7 @@
                 self.stop_here(frame) or
                 self.__checkBreakInFrame(frame) or
                 Watch.watches != []
-            ):
-                return self.trace_dispatch
-            elif (
+            ) or (
                 self.stopframe and
                 frame.f_code.co_flags & GENERATOR_AND_COROUTINE_FLAGS
             ):
@@ -925,11 +922,11 @@
         if excval is None:
             excval = ''
         
-        if unhandled:
-            exctypetxt = "unhandled {0!s}".format(str(exctype))
-        else:
-            exctypetxt = str(exctype)
-        
+        exctypetxt = (
+            "unhandled {0!s}".format(str(exctype))
+            if unhandled else
+            str(exctype)
+        )
         excvaltxt = str(excval)
         
         # Don't step into libraries, which are used by our debugger methods

eric ide

mercurial