[docs] [issue19876] selectors (and asyncio?): document behaviour on closed files/sockets

Charles-François Natali report at bugs.python.org
Fri Dec 6 23:59:10 CET 2013

Charles-François Natali added the comment:

> Guido van Rossum added the comment:
> Here's an attempt at fixing the ValueError.
> I don't like the exhaustive search much, but the alternative is to maintain an inverse dict.  What do you think?

I was going to suggest such an exhaustive search.
I think it's the cleanest/simplest solution, and the performance
overhead is IMO completely unimportant since it's not supposed to
happen often, and if the key isn't found we're going to raise an
exception anyway.

So if we want to handle this case (and I think we should to be
consistent), that's the best way to go.

But I think that OSError should still be caught in
EpollSelector.unregister(): since if the FD is closed before,
epoll.unregister() will raise ENOENT/EBADF since the FD will have
automatically been removed (exactly as for kqueue according to the man


Python tracker <report at bugs.python.org>

More information about the docs mailing list