[Twisted-Python] twisted.internet.stdio: wrong initialisation

W.J. miathan at goliath.darktech.org
Sun Jun 1 09:59:48 MDT 2003


Hello,

In twisted.internet.stdio, makeConnection is called on the protocol 
before the writer is set. This is Not Good(TM) because the 
makeConnection might write a welcome banner in some protocols
(twisted.protcols.telnet, for example).

This patch will fix this

--- Twisted/twisted/internet/stdio.py   2003-03-31 21:31:15.000000000 
+0200
+++ Twisted-1.0.5/twisted/internet/stdio.py     2003-06-01 
17:55:26.000000000 +0200
@@ -82,10 +82,11 @@
          _stdio_in_use = 1
          self.fileno = sys.__stdin__.fileno
          fdesc.setNonBlocking(self.fileno())
+        self.writer = StandardIOWriter()
          self.protocol = protocol
          self.protocol.makeConnection(self)
          self.startReading()
-        self.writer = StandardIOWriter()
       def write(self, data):
          """Write some data to standard output.


Wladimir




More information about the Twisted-Python mailing list