Merged with debugger changes done by Tobias.

Thu, 30 Mar 2017 18:58:51 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 30 Mar 2017 18:58:51 +0200
changeset 5668
9ddb22979968
parent 5666
aa3532e96210 (current diff)
parent 5667
86554f131048 (diff)
child 5669
63295be38bc6

Merged with debugger changes done by Tobias.

--- a/DebugClients/Python/DebugBase.py	Wed Mar 29 19:23:50 2017 +0200
+++ b/DebugClients/Python/DebugBase.py	Thu Mar 30 18:58:51 2017 +0200
@@ -65,6 +65,9 @@
 
     # cache for fixed file names
     _fnCache = {}
+    
+    # Stop all timers, when greenlets are used
+    pollTimerEnabled = True 
 
     def __init__(self, dbgClient):
         """
@@ -112,9 +115,11 @@
         """
         Private method to set a flag every 0.5 s to check for new messages.
         """
-        while True:
+        while DebugBase.pollTimerEnabled:
             time.sleep(0.5)
             self.eventPollFlag = True
+        
+        self.eventPollFlag = False
     
     def getCurrentFrame(self):
         """
--- a/DebugClients/Python/ThreadExtension.py	Wed Mar 29 19:23:50 2017 +0200
+++ b/DebugClients/Python/ThreadExtension.py	Thu Mar 30 18:58:51 2017 +0200
@@ -39,6 +39,7 @@
         self._original_start_new_thread = None
         self.threadingAttached = False
         self.qtThreadAttached = False
+        self.greenlet = False
         
         self.clientLock = threading.RLock()
         
@@ -260,7 +261,7 @@
             return None
         
         if fullname in [self.threadModName, 'PyQt4.QtCore', 'PyQt5.QtCore',
-                        'PySide.QtCore', 'PySide2.QtCore',
+                        'PySide.QtCore', 'PySide2.QtCore', 'greenlet',
                         'threading'] and self.enableImportHooks:
             # Disable hook to be able to import original module
             self.enableImportHooks = False
@@ -285,6 +286,14 @@
             self._original_start_new_thread = module.start_new_thread
             module.start_new_thread = self.attachThread
 
+        elif (fullname == 'greenlet' and self.greenlet is False):
+            # Check for greenlet.settrace
+            if hasattr(module, 'settrace'):
+                self.greenlet = True
+                DebugBase.pollTimerEnabled = False
+            
+            # TODO: Implement the debugger extension for greenlets
+        
         # Add hook for threading.run()
         elif (fullname == "threading" and self.threadingAttached is False):
             self.threadingAttached = True
--- a/changelog	Wed Mar 29 19:23:50 2017 +0200
+++ b/changelog	Thu Mar 30 18:58:51 2017 +0200
@@ -13,6 +13,7 @@
   -- move the instruction pointer within the current function (Hotkey: F12)
   -- report syntax and indentation errors raised by an application or module
      in the correct manner
+  -- avoid crashes on using greenlets
 - Mercurial Interface
   -- extended the user configuration dialog
 

eric ide

mercurial