Charles-François Natali added the comment:

> The second test runs fine on Linux, and from a cursory look, I don't
> see how it could fail (the socket should be reported as write ready
> upon ECONNREFUSED).

Hum, thinking about it, I wonder is OS-X doesn't report POLLPRI or
some other esoteric event in case of ECONNREFUSED...

Could you try the patch attached?

----------
Added file: http://bugs.python.org/file28606/selector_poll_events.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16853>
_______________________________________
--- tulip/selectors.py.orig     2013-01-07 11:33:56.035521000 +0100
+++ tulip/selectors.py  2013-01-07 11:46:04.351542000 +0100
@@ -242,15 +242,10 @@
         ready = []
         for fd, event in self._poll.poll(timeout):
             events = 0
-            if event & (POLLERR|POLLNVAL):
-                # in case of error, signal read and write ready
-                events |= SELECT_IN|SELECT_OUT
-            else:
-                if event & (POLLIN|POLLHUP):
-                    # in case of hangup, signal read ready
-                    events |= SELECT_IN
-                if event & POLLOUT:
-                    events |= SELECT_OUT
+            if event & ~POLLOUT:
+                events |= SELECT_IN
+            if event & ~POLLIN:
+                events |= SELECT_OUT
 
             key = self._key_from_fd(fd)
             ready.append((key.fileobj, events, key.data))
@@ -282,15 +277,10 @@
         ready = []
         for fd, event in self._epoll.poll(timeout, self.registered_count()):
             events = 0
-            if event & EPOLLERR:
-                # in case of error, signal read and write ready
-                events |= SELECT_IN|SELECT_OUT
-            else:
-                if event & (EPOLLIN|EPOLLHUP):
-                    # in case of hangup, signal read ready
-                    events |= SELECT_IN
-                if event & EPOLLOUT:
-                    events |= SELECT_OUT
+            if event & ~EPOLLOUT:
+                events |= SELECT_IN
+            if event & ~EPOLLIN:
+                events |= SELECT_OUT
 
             key = self._key_from_fd(fd)
             ready.append((key.fileobj, events, key.data))
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to