[py-svn] r13636 - py/branch/execnet-refactoring

arigo at codespeak.net arigo at codespeak.net
Mon Jun 20 23:27:16 CEST 2005


Author: arigo
Date: Mon Jun 20 23:27:14 2005
New Revision: 13636

Modified:
   py/branch/execnet-refactoring/channel.py
   py/branch/execnet-refactoring/gateway.py
Log:
Good!  With the last fix in py.thread.pool, the automatic closing of channels
seems to work nicely.  At least, the tests are happy.


Modified: py/branch/execnet-refactoring/channel.py
==============================================================================
--- py/branch/execnet-refactoring/channel.py	(original)
+++ py/branch/execnet-refactoring/channel.py	Mon Jun 20 23:27:14 2005
@@ -41,14 +41,15 @@
         return "<Channel id=%d %s>" % (self.id, flag)
 
     def __del__(self):
+        if self.gateway is None:   # can be None in tests
+            return
         self.gateway.trace("Channel(%d).__del__" % self.id)
         if not self._closed:
-            if self.gateway is not None:   # can be None in tests
-                if self._items is None:    # has_callback
-                    Msg = Message.CHANNEL_LAST_MESSAGE
-                else:
-                    Msg = Message.CHANNEL_CLOSE
-                self.gateway._outgoing.put(Msg(self.id))
+            if self._items is None:    # has_callback
+                Msg = Message.CHANNEL_LAST_MESSAGE
+            else:
+                Msg = Message.CHANNEL_CLOSE
+            self.gateway._outgoing.put(Msg(self.id))
         else:
             error = self._getstickyerror()
             if isinstance(error, RemoteError):

Modified: py/branch/execnet-refactoring/gateway.py
==============================================================================
--- py/branch/execnet-refactoring/gateway.py	(original)
+++ py/branch/execnet-refactoring/gateway.py	Mon Jun 20 23:27:14 2005
@@ -159,7 +159,7 @@
             channel.close(errortext)
             self.trace(errortext)
         else:
-            channel.close() # XXX -- should usually be closed by Channel.__del__
+            pass #channel.close() -- should usually be closed by Channel.__del__
 
     def _local_schedulexec(self, channel, sourcetask): 
         self.trace("dispatching exec")



More information about the pytest-commit mailing list