1. holger krekel
  2. execnet

Commits

holger krekel  committed df0c162

try harder to avoid bogus tracebacks, aim at execnet-1.0.4

  • Participants
  • Parent commits ca2fc9a
  • Branches default

Comments (0)

Files changed (3)

File CHANGELOG

View file
+1.0.4
+--------------------------------
+
+- try harder to not have globals involved during finalization handling, 
+  this should (hopefully) fix bogus tracebacks at process exit. 
+
 1.0.3
 --------------------------------
 

File execnet/__init__.py

View file
 
 (c) 2010, Holger Krekel and others
 """
-__version__ = "1.0.3"
+__version__ = "1.0.4"
 
 import execnet.apipkg
 

File execnet/gateway_base.py

View file
 
 _setupmessages()
 
-def geterrortext(excinfo):
+def geterrortext(excinfo, format_exception=traceback.format_exception):
     try:
-        l = traceback.format_exception(*excinfo)
+        l = format_exception(*excinfo)
         errortext = "".join(l)
     except sysex:
         raise
             except:
                 excinfo = sys.exc_info()
                 self.gateway._trace("exception during callback: %s" % excinfo[1])
-                errortext = geterrortext(excinfo)
+                errortext = self.gateway._geterrortext(excinfo)
                 self.gateway._send(Message.CHANNEL_CLOSE_ERROR(id, errortext))
                 self._local_close(id, errortext)
 
         self._channelfactory = ChannelFactory(self, _startcount)
         self._receivelock = threading.RLock()
         self._serializer = Serializer(io)
-        self._globaltrace = trace  # globals may be NONE at process-termination
+        # globals may be NONE at process-termination
+        self._globaltrace = trace  
+        self._geterrortext = geterrortext
 
     def _trace(self, *msg):
         self._globaltrace(self.id, *msg)
                 self._io.close_read()
             except EOFError:
                 self._trace("receiverthread: got EOFError")
-                self._trace("traceback was: ", geterrortext(self.exc_info()))
+                self._trace("traceback was: ", 
+                    self._geterrortext(self.exc_info()))
                 self._error = self.exc_info()[1]
                 eof = True
             except:
-                self._trace("RECEIVERTHREAD", geterrortext(self.exc_info()))
+                self._trace("RECEIVERTHREAD", self._geterrortext(self.exc_info()))
         finally:
             self._channelfactory._finished_receiving()
             if eof:
         except:
             excinfo = self.exc_info()
             self._trace("got exception: %s" % (excinfo[1],))
-            errortext = geterrortext(excinfo)
+            errortext = self._geterrortext(excinfo)
             channel.close(errortext)
         else:
             channel.close()