[Python-checkins] r56463 - python/trunk/Lib/test/test_asyncore.py

facundo.batista python-checkins at python.org
Fri Jul 20 01:57:38 CEST 2007


Author: facundo.batista
Date: Fri Jul 20 01:57:38 2007
New Revision: 56463

Modified:
   python/trunk/Lib/test/test_asyncore.py
Log:

Added a select.select call in the test server loop to make sure the
socket is ready to be read from before attempting a read (this
prevents an error 10035 on some Windows platforms). [GSoC - Alan
McIntyre]


Modified: python/trunk/Lib/test/test_asyncore.py
==============================================================================
--- python/trunk/Lib/test/test_asyncore.py	(original)
+++ python/trunk/Lib/test/test_asyncore.py	Fri Jul 20 01:57:38 2007
@@ -65,11 +65,13 @@
     else:
         n = 200
         while n > 0:
-            data = conn.recv(10)
-            # keep everything except for the newline terminator
-            buf.write(data.replace('\n', ''))
-            if '\n' in data:
-                break
+            r, w, e = select.select([conn], [], [])
+            if r:
+                data = conn.recv(10)
+                # keep everything except for the newline terminator
+                buf.write(data.replace('\n', ''))
+                if '\n' in data:
+                    break
             n -= 1
             time.sleep(0.01)
 


More information about the Python-checkins mailing list