]> granicus.if.org Git - python/commitdiff
Avoid problem resolving 'localhost'
authorKurt B. Kaiser <kbk@shore.net>
Thu, 5 Jun 2003 23:51:29 +0000 (23:51 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Thu, 5 Jun 2003 23:51:29 +0000 (23:51 +0000)
M PyShell.py
M rpc.py
M run.py

Lib/idlelib/PyShell.py
Lib/idlelib/rpc.py
Lib/idlelib/run.py

index db4a05b38ee38aa6a082233dd292fc3eb4542982..e556af352fac6af7d337f2a7d5193764216303da 100644 (file)
@@ -35,6 +35,7 @@ import Debugger
 import RemoteDebugger
 
 IDENTCHARS = string.ascii_letters + string.digits + "_"
+LOCALHOST = '127.0.0.1'
 
 try:
     from signal import SIGTERM
@@ -336,7 +337,7 @@ class ModifiedInterpreter(InteractiveInterpreter):
         return [sys.executable] + w + ["-c", command, str(self.port)]
 
     def start_subprocess(self):
-        addr = ("localhost", self.port)
+        addr = (LOCALHOST, self.port)
         # Idle starts listening for connection on localhost
         for i in range(3):
             time.sleep(i)
index 658aaf37f5543720d2dd1d221a7042c769c8b0d2..63e0ffa814dc803bdfd9b047e587f0a679fe24f2 100644 (file)
@@ -64,6 +64,7 @@ copy_reg.pickle(types.CodeType, pickle_code, unpickle_code)
 # copy_reg.pickle(types.FunctionType, pickle_function, unpickle_function)
 
 BUFSIZE = 8*1024
+LOCALHOST = '127.0.0.1'
 
 class RPCServer(SocketServer.TCPServer):
 
@@ -525,7 +526,7 @@ class RPCClient(SocketIO):
         working_sock, address = self.listening_sock.accept()
         if self.debugging:
             print>>sys.__stderr__, "****** Connection request from ", address
-        if address[0] == '127.0.0.1':
+        if address[0] == LOCALHOST:
             SocketIO.__init__(self, working_sock)
         else:
             print>>sys.__stderr__, "** Invalid host: ", address
@@ -655,7 +656,7 @@ def testClient(addr):
     # clt.remotecall("thomas","greet_this_guy",("alexander",), {})
 
 def test():
-    addr=("localhost",8833)
+    addr=(LOCALHOST, 8833)
     if len(sys.argv) == 2:
         if sys.argv[1]=='-server':
             testServer(addr)
index 8b1555d05afef2084e4e71a8f62d275048d9160a..5e86e47f9753fb34d4912d5fdb50a9e3898a1d0f 100644 (file)
@@ -17,6 +17,8 @@ import interrupt
 
 import __main__
 
+LOCALHOST = '127.0.0.1'
+
 # Thread shared globals: Establish a queue between a subthread (which handles
 # the socket) and the main thread (which runs user code), plus global
 # completion and exit flags:
@@ -52,7 +54,7 @@ def main(del_exitfunc=False):
     sys.argv[:] = [""]
     sockthread = threading.Thread(target=manage_socket,
                                   name='SockThread',
-                                  args=(('localhost', port),))
+                                  args=((LOCALHOST, port),))
     sockthread.setDaemon(True)
     sockthread.start()
     while 1: