Armin Rigo avatar Armin Rigo committed 89abd94

(iko, rguillebert, arigo)

Don't use Mac OS/X may-be-broken implementation of poll().

Comments (0)

Files changed (2)

pypy/rlib/_rsocket_rffi.py

 _MSVC  = target_platform.name == "msvc"
 _MINGW = target_platform.name == "mingw32"
 _SOLARIS = sys.platform == "sunos5"
+_MACOSX = sys.platform == "darwin"
 
 if _POSIX:
     includes = ('sys/types.h',
     pollfdarray = rffi.CArray(pollfd)
     poll = external('poll', [lltype.Ptr(pollfdarray), nfds_t, rffi.INT],
                     rffi.INT)
-    
+    # workaround for Mac OS/X on which poll() seems to behave a bit strangely
+    # (see test_recv_send_timeout in pypy.module._socket.test.test_sock_app)
+    # https://issues.apache.org/bugzilla/show_bug.cgi?id=34332
+    poll_may_be_broken = _MACOSX
+
 elif WIN32:
     from pypy.rlib import rwin32
     #

pypy/rlib/rsocket.py

             _c.ioctlsocket(self.fd, _c.FIONBIO, flag)
             lltype.free(flag, flavor='raw')
 
-    if hasattr(_c, 'poll'):
+    if hasattr(_c, 'poll') and not _c.poll_may_be_broken:
         def _select(self, for_writing):
             """Returns 0 when reading/writing is possible,
             1 when timing out and -1 on error."""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.