]> granicus.if.org Git - python/commitdiff
On Windows, select() does not accept empty lists.
authorThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:30:31 +0000 (17:30 +0000)
committerThomas Heller <theller@ctypes.org>
Tue, 24 Sep 2002 17:30:31 +0000 (17:30 +0000)
Patch suggested by Guido, fixes SF item 611464.

Bugfix candidate, will backport to release22-maint myself.

Lib/asyncore.py

index 5ab62255fa5c48ef72adbd777e57035899ed8234..abbbae69adee13703809446347a1ce57ed2848a7 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, \
@@ -100,11 +101,14 @@ 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
+        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] not in (EINTR, ENOENT):
+                    raise
 
         for fd in r:
             obj = map.get(fd)