[Twisted-Python] t.i.tcp bug -- a possible fix

Moshe Zadka twisted at moshez.org
Thu Feb 20 03:56:54 EST 2003

Index: twisted/internet/tcp.py
RCS file: /cvs/Twisted/twisted/internet/tcp.py,v
retrieving revision 1.108
diff -u -r1.108 tcp.py
--- twisted/internet/tcp.py     19 Feb 2003 07:18:29 -0000      1.108
+++ twisted/internet/tcp.py     20 Feb 2003 00:55:28 -0000
@@ -283,7 +283,8 @@
             skt = self.createInternetSocket()
         except socket.error, se:
             err = error.ConnectBindError(se[0], se[1])
-            whenDone = None
+            self.connector.connectionFailed(failure.Failure(err))
+            return
         if whenDone and bindAddress is not None:

Without this patch, skt is unbound if the except was triggered. A few lines
later, "skt" is used, prompting an UnboundLocalVariable exception. This
might not be the correct patch, but it does appear to solve stuff...

Moshe Zadka -- http://moshez.org/
Buffy: I don't like you hanging out with someone that... short.
Riley: Yeah, a lot of young people nowadays are experimenting with shortness.

More information about the Twisted-Python mailing list