# Buggy code
def unregister(self, fileobj):
    key = super(KqueueSelector, self).unregister(fileobj)
    if key.events & EVENT_READ:
        kevent = select.kevent(key.fd, select.KQ_FILTER_READ, select.KQ_EV_DELETE)
        try:
            _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
        except SelectorError:
            pass
    if key.events & EVENT_WRITE:
        kevent = select.kevent(key.fd, select.KQ_FILTER_WRITE, select.KQ_EV_DELETE)
        try:
            _syscall_wrapper(self._kqueue.control, False, [kevent], 0, 0)
        except SelectorError:
            pass

    return key


# Traceback (TypeError)
The full traceback is:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 138, in run
res = self._execute()
File "/usr/lib/python2.7/dist-packages/ansible/executor/task_executor.py", line 561, in _execute
result = self._handler.run(task_vars=variables)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/command.py", line 24, in run
results = merge_hash(results, self._execute_module(task_vars=task_vars, wrap_async=wrap_async))
File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 810, in _execute_module
res = self._low_level_execute_command(cmd, sudoable=sudoable, in_data=in_data)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/action/__init__.py", line 917, in _low_level_execute_command
rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py", line 984, in exec_command
(returncode, stdout, stderr) = self._run(cmd, in_data, sudoable=sudoable)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py", line 258, in wrapped
return_tuple = func(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py", line 878, in _run
return self._bare_run(cmd, in_data, sudoable=sudoable, checkrc=checkrc)
File "/usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py", line 715, in _bare_run
events = selector.select(timeout)
File "/usr/lib/python2.7/dist-packages/ansible/compat/selectors/_selectors2.py", line 464, in select
maxevents=max_events)
File "/usr/lib/python2.7/dist-packages/ansible/compat/selectors/_selectors2.py", line 139, in _syscall_wrapper
raise OSError(errno=errno.ETIMEDOUT)
TypeError: exceptions.OSError does not take keyword arguments

fatal: [staging.bizlock.net]: FAILED! => {
"msg": "Unexpected failure during module execution.",
"stdout": ""
}

# Fixed code
def unregister(self, fileobj):
    key = super(KqueueSelector, self).unregister(fileobj)
    if key.events & EVENT_READ:
        kevent = select.kevent(key.fd, select.KQ_FILTER_READ, select.KQ_EV_DELETE)
        try:
            _syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
        except SelectorError:
            pass
    if key.events & EVENT_WRITE:
        kevent = select.kevent(key.fd, select.KQ_FILTER_WRITE, select.KQ_EV_DELETE)
        try:
            _syscall_wrapper(self._wrap_control, False, [kevent], 0, 0)
        except SelectorError:
            pass

    return key