If you shutdown a non-blocking socket:
sock.setblocking(False)
...
sock.shutdown(SHUT_RDWR)
is it possible that the call to shutdown will raise a BlockingIOError, and if so, under what conditions? I've not experienced it happening, but this (of course) doesn't mean it can't happen.