[Python-checkins] python/dist/src/Lib/test test_logging.py,1.3,1.4

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 21 Jan 2003 13:05:25 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv5076

Modified Files:
	test_logging.py 
Log Message:
Fix from Vinaj for the "writing to closed file" errors.  SF 670390.


Index: test_logging.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_logging.py	15 Jan 2003 23:43:02 -0000	1.3
--- test_logging.py	21 Jan 2003 21:05:20 -0000	1.4
***************
*** 25,29 ****
  """
  
! from select import select
  import os, sys, string, struct, types, cPickle, cStringIO
  import socket, threading, time, locale
--- 25,29 ----
  """
  
! import select
  import os, sys, string, struct, types, cPickle, cStringIO
  import socket, threading, time, locale
***************
*** 65,69 ****
                      break
                  slen = struct.unpack(">L", chunk)[0]
-                 #print slen
                  chunk = self.connection.recv(slen)
                  while len(chunk) < slen:
--- 65,68 ----
***************
*** 103,107 ****
          abort = 0
          while not abort:
!             rd, wr, ex = select([self.socket.fileno()],
                                         [], [],
                                         self.timeout)
--- 102,106 ----
          abort = 0
          while not abort:
!             rd, wr, ex = select.select([self.socket.fileno()],
                                         [], [],
                                         self.timeout)
***************
*** 110,113 ****
--- 109,118 ----
              abort = self.abort
  
+     def process_request(self, request, client_address):
+         #import threading
+         t = threading.Thread(target = self.finish_request,
+                              args = (request, client_address))
+         t.start()
+ 
  def runTCP(tcpserver):
      tcpserver.serve_until_stopped()
***************
*** 422,426 ****
      threads = []
      tcpserver = LogRecordSocketReceiver()
!     sys.stdout.write("About to start TCP server...\n")
      threads.append(threading.Thread(target=runTCP, args=(tcpserver,)))
  
--- 427,431 ----
      threads = []
      tcpserver = LogRecordSocketReceiver()
!     #sys.stdout.write("About to start TCP server...\n")
      threads.append(threading.Thread(target=runTCP, args=(tcpserver,)))
  
***************
*** 448,456 ****
          banner("log_test3", "end")
  
-         banner("logrecv output", "begin")
-         sys.stdout.write(sockOut.getvalue())
-         sockOut.close()
-         banner("logrecv output", "end")
- 
      finally:
          #shut down server
--- 453,456 ----
***************
*** 458,464 ****
          for thread in threads:
              thread.join()
  
  if __name__ == "__main__":
      sys.stdout.write("test_logging\n")
      test_main()
-     sys.stdout.flush()
--- 458,468 ----
          for thread in threads:
              thread.join()
+         banner("logrecv output", "begin")
+         sys.stdout.write(sockOut.getvalue())
+         sockOut.close()
+         banner("logrecv output", "end")
+         sys.stdout.flush()
  
  if __name__ == "__main__":
      sys.stdout.write("test_logging\n")
      test_main()