]> git-server-git.apps.pok.os.sepia.ceph.com Git - remoto.git/commitdiff
fix more TypeErrors when closing the connection
authorAlfredo Deza <alfredo@deza.pe>
Tue, 29 Oct 2013 18:05:26 +0000 (14:05 -0400)
committerAlfredo Deza <alfredo@deza.pe>
Tue, 29 Oct 2013 18:05:26 +0000 (14:05 -0400)
remoto/lib/execnet/__init__.py
remoto/lib/execnet/gateway_base.py

index a975ea69e16ff0417e1cf95131459be241c2a395..0dc577d24f719a2dc7d61ecaf4c9bf89ad776762 100644 (file)
@@ -3,7 +3,7 @@ execnet: pure python lib for connecting to local and remote Python Interpreters.
 
 (c) 2012, Holger Krekel and others
 """
-__version__ = '1.1-ad2'
+__version__ = '1.1-ad3'
 
 from . import apipkg
 
@@ -27,6 +27,10 @@ apipkg.initpkg(__name__, {
 
 # CHANGELOG
 #
+# 1.1-ad3: Catch more `TypeError` if the connection is closing but the channel attempts
+# to write. We now check is `struct.pack` is not None to proceed.
+# Issue: https://bitbucket.org/hpk42/execnet/issue/22/structpack-can-be-none-sometimes-spits
+#
 # 1.1-ad2: Allow for `sudo python` on local popen gateways
 # Issue: https://bitbucket.org/hpk42/execnet/issue/21/support-sudo-on-local-popen
 #
index 2313babb7a7d31b6bf979ac4d50317c34abb81a1..69a60c9189aacd2e0c31c19b6bbff46dff5a5902 100644 (file)
@@ -126,8 +126,9 @@ class Message:
         return Message(msgtype, channel, io.read(payload))
 
     def to_io(self, io):
-        header = struct.pack('!bii', self.msgcode, self.channelid, len(self.data))
-        io.write(header+self.data)
+        if struct.pack is not None:
+            header = struct.pack('!bii', self.msgcode, self.channelid, len(self.data))
+            io.write(header+self.data)
 
     def received(self, gateway):
         self._types[self.msgcode](self, gateway)