Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8ce87a

Browse files
author
Thomas Heller
committed
On Windows, select() does not accept empty lists.
Patch suggested by Guido, fixes SF item 611464. Bugfix candidate, will backport to release22-maint myself.
1 parent 7bdabe6 commit d8ce87a

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Lib/asyncore.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import select
5151
import socket
5252
import sys
53+
import time
5354

5455
import os
5556
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
@@ -100,11 +101,14 @@ def poll(timeout=0.0, map=None):
100101
r.append(fd)
101102
if obj.writable():
102103
w.append(fd)
103-
try:
104-
r, w, e = select.select(r, w, e, timeout)
105-
except select.error, err:
106-
if err[0] != EINTR:
107-
raise
104+
if [] == r == w == e:
105+
time.sleep(timeout)
106+
else:
107+
try:
108+
r, w, e = select.select(r, w, e, timeout)
109+
except select.error, err:
110+
if err[0] not in (EINTR, ENOENT):
111+
raise
108112

109113
for fd in r:
110114
obj = map.get(fd)

0 commit comments

Comments
 (0)