diff options
author | Thomas Heller <theller@ctypes.org> | 2002-09-24 17:30:31 (GMT) |
---|---|---|
committer | Thomas Heller <theller@ctypes.org> | 2002-09-24 17:30:31 (GMT) |
commit | d8ce87ad84d748fb648b874d7dd9d9a3a835ec3d (patch) | |
tree | 0201eb5db19f246c1fcd458031d4b99a56a24103 /Lib | |
parent | 7bdabe67a362598dcd6212e9d1c875c80a4d1332 (diff) | |
download | cpython-d8ce87ad84d748fb648b874d7dd9d9a3a835ec3d.zip cpython-d8ce87ad84d748fb648b874d7dd9d9a3a835ec3d.tar.gz cpython-d8ce87ad84d748fb648b874d7dd9d9a3a835ec3d.tar.bz2 |
On Windows, select() does not accept empty lists.
Patch suggested by Guido, fixes SF item 611464.
Bugfix candidate, will backport to release22-maint myself.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/asyncore.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 5ab6225..abbbae6 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -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) |