Commits

mattip  committed 02e4714

give up on poll() for win32, rely on lib-python -A test_ftplib for verification

  • Participants
  • Parent commits bc9fdf9
  • Branches win32-fixes4

Comments (0)

Files changed (3)

File pypy/module/_ssl/interp_ssl.py

 SOCKET_HAS_TIMED_OUT, SOCKET_HAS_BEEN_CLOSED = 2, 3
 SOCKET_TOO_LARGE_FOR_SELECT, SOCKET_OPERATION_OK = 4, 5
 
-HAVE_RPOLL = True  # Even win32 has rpoll.poll
+HAVE_RPOLL = 'poll' in dir(rpoll)
 
 constants = {}
 constants["SSL_ERROR_ZERO_RETURN"] = PY_SSL_ERROR_ZERO_RETURN

File rpython/rlib/rpoll.py

 # poll() for Win32
 #
 if hasattr(_c, 'WSAEventSelect'):
-
-    def poll(fddict, timeout=-1):
+    # WSAWaitForMultipleEvents is broken. If you wish to try it,
+    # rename the function to poll() and run test_exchange in test_rpoll
+    def _poll(fddict, timeout=-1):
         """'fddict' maps file descriptors to interesting events.
         'timeout' is an integer in milliseconds, and NOT a float
         number of seconds, but it's the same in CPython.  Use -1 for infinite.
             if timeout < 0:
                 timeout = _c.INFINITE
 
+            # XXX does not correctly report write status of a port
             ret = _c.WSAWaitForMultipleEvents(numevents, socketevents,
                                               False, timeout, False)
 

File rpython/rlib/test/test_rpoll.py

 import py
 
 from rpython.rlib.rsocket import *
-from rpython.rlib.rpoll import *
+try:
+    from rpython.rlib.rpoll import poll
+except ImportError:
+    py.test.skip('no poll available on this platform')
 from rpython.rtyper.test.test_llinterp import interpret
 
 def setup_module(mod):
     serv.close()
 
 def test_exchange():
+    if not poll:
+        py.test.skip('poll not available for this platform')
     serv = RSocket(AF_INET, SOCK_STREAM)
     serv.bind(INETAddress('127.0.0.1', INADDR_ANY))
     serv.listen(1)
     assert len(events) == 0
 
     cli = RSocket(AF_INET, SOCK_STREAM)
-    cli.setblocking(False)
+    cli.setblocking(True)
     err = cli.connect_ex(servaddr)
-    assert err != 0
+    assert err == 0
 
     events = poll({serv.fd: POLLIN}, timeout=500)
     one_in_event(events, serv.fd)