]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport of the checkin of revision 1.36 of asyncore.py
authorThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:44:40 +0000 (17:44 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:44:40 +0000 (17:44 +0000)
On Windows, select() does not accept empty lists.
Patch suggested by Guido, fixes SF item 611464.

Bugfix candidate, will backport to release22-maint myself.

Lib/asyncore.py

index 96cc9cc77c2e66c8fb59604f93c3233116e0eb50..bae416b560636ce253431b200fc724bd14241a5c 100644 (file)
@@ -50,6 +50,7 @@ import exceptions
 import select
 import socket
 import sys
+import time
 
 import os
 from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
@@ -75,12 +76,15 @@ def poll (timeout=0.0, map=None):
                 r.append (fd)
             if obj.writable():
                 w.append (fd)
-        try:
-            r,w,e = select.select (r,w,e, timeout)
-        except select.error, err:
-            if err[0] != EINTR:
-                raise
-            r = []; w = []; e = []
+        if [] == r == w == e:
+            time.sleep(timeout)
+        else:
+            try:
+                r,w,e = select.select (r,w,e, timeout)
+            except select.error, err:
+                if err[0] != EINTR:
+                    raise
+                r = []; w = []; e = []
 
         if DEBUG:
             print r,w,e