Issue #5798: Handle select.poll flag oddities properly on OS X.

This fixes test_asynchat and test_smtplib failures on OS X.
(Backport of r73182 from trunk.)
This commit is contained in:
Mark Dickinson 2010-08-04 14:42:13 +00:00
parent 042cf1ae8c
commit f34e396b18
2 changed files with 20 additions and 2 deletions

View file

@ -103,10 +103,16 @@ def readwrite(obj, flags):
obj.handle_read_event()
if flags & select.POLLOUT:
obj.handle_write_event()
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
obj.handle_close()
if flags & select.POLLPRI:
obj.handle_expt_event()
if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
obj.handle_close()
except socket.error, e:
if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN,
ECONNABORTED):
obj.handle_error()
else:
obj.handle_close()
except _reraised_exceptions:
raise
except: