Fix bug in Reactor.unregister().
Consistently return registered files from Reactor.poll().

Ensures that the registered object is always the one returned from
poll(). Also uses sock rather than socket for socket variables to avoid
possible conflict with the socket module.