[issue16853] add a Selector to the select module

Guido van Rossum report at bugs.python.org
Tue Jan 8 01:45:47 CET 2013


Guido van Rossum added the comment:

There's a bug in the kqueue selector.  The following code in your patch has 'fd' instead of 'key.fd', twice:

            if events & SELECT_IN:
                kev = kevent(key.fd, KQ_FILTER_READ, KQ_EV_ADD)
                self._kqueue.control([kev], 0, 0)
            if events & SELECT_OUT:
                kev = kevent(key.fd, KQ_FILTER_WRITE, KQ_EV_ADD)
		self._kqueue.control([kev], 0, 0)

One kqueue test fails on OSX:

ERROR: test_sock_client_ops (tulip.events_test.KqueueEventLoopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/guido/tulip/tulip/selectors.py", line 178, in _key_from_fd
    return self._fd_to_key[fd]
KeyError: 11

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/guido/tulip/tulip/events_test.py", line 167, in test_sock_client_ops
    el.run_until_complete(el.sock_sendall(sock, b'GET / HTTP/1.0\r\n\r\n'))
  File "/Users/guido/tulip/tulip/unix_events.py", line 146, in run_until_complete
    self.run()
  File "/Users/guido/tulip/tulip/unix_events.py", line 110, in run
    self._run_once()
  File "/Users/guido/tulip/tulip/unix_events.py", line 582, in _run_once
    event_list = self._selector.select(timeout)
  File "/Users/guido/tulip/tulip/selectors.py", line 329, in select
    key = self._key_from_fd(fd)
  File "/Users/guido/tulip/tulip/selectors.py", line 180, in _key_from_fd
    raise RuntimeError("No key found for fd {}".format(fd))
RuntimeError: No key found for fd 11

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16853>
_______________________________________


More information about the Python-bugs-list mailing list