Skip to content

Commit e94d8fa

Browse files
committed
Fix an old bug in poll(). When a signal is handled while we're
blocked in select(), this will raise select.error with errno set to EINTR. The except clauses correctly ignores this error, but the rest of the logic will then call read() for all objects in select's *input* list of read file descriptors. Then when an object's read_handler() is naive, it will call recv() on its socket, which will raise an IOError, and then asyncore decides to close the socket. To fix this, we simply return in this case. Backport candidate.
1 parent 18142c0 commit e94d8fa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/asyncore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def poll(timeout=0.0, map=None):
109109
except select.error, err:
110110
if err[0] != EINTR:
111111
raise
112+
else:
113+
return
112114

113115
for fd in r:
114116
obj = map.get(fd)

0 commit comments

Comments
 (0)