Author: Matti Picus <[email protected]>
Branch: win32-fixes4
Changeset: r70332:02e471453e7b
Date: 2014-03-30 06:12 +0300
http://bitbucket.org/pypy/pypy/changeset/02e471453e7b/
Log: give up on poll() for win32, rely on lib-python -A test_ftplib for
verification
diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -35,7 +35,7 @@
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
diff --git a/rpython/rlib/rpoll.py b/rpython/rlib/rpoll.py
--- a/rpython/rlib/rpoll.py
+++ b/rpython/rlib/rpoll.py
@@ -141,8 +141,9 @@
# 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.
@@ -188,6 +189,7 @@
if timeout < 0:
timeout = _c.INFINITE
+ # XXX does not correctly report write status of a port
ret = _c.WSAWaitForMultipleEvents(numevents, socketevents,
False, timeout, False)
diff --git a/rpython/rlib/test/test_rpoll.py b/rpython/rlib/test/test_rpoll.py
--- a/rpython/rlib/test/test_rpoll.py
+++ b/rpython/rlib/test/test_rpoll.py
@@ -3,7 +3,10 @@
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):
@@ -62,6 +65,8 @@
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)
@@ -71,9 +76,9 @@
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)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit