The answer may be OS dependent. I answer only on Linux.
I do not know the differences regarding blocking / non-blocking sockets in select, but in linux on the select system call control page there is this in the "ERRORS" section:
On Linux, select () can tell the socket file descriptor to be "ready to read," though, however, subsequent read blocks. It could, it can for example, when the data has arrived, but after the wrong checksum is discarded. There may be other circumstances in which the file descriptor is falsely reported as ready. Thus, it may be safer to use O_NONBLOCK on sockets that should not block.
I doubt the python abstraction above, which can "hide" this problem without side effects.
As for locking the record sending more data, this was expected. send will block until there is enough buffer space to send the entire request down if the socket is blocked. If the socket is not blocked, it sends only as much as it can insert into the socket send buffer.
source share