http://hg.python.org/cpython/file/96d817f41c4c/Modules/socketmodule.c#l614 CID 715331 (#1 of 1): Unchecked return value from library (CHECKED_RETURN) 5. check_return: Calling function "fcntl(s->sock_fd, 4, delay_flag)" without checking return value. This library function may fail and return an error code. It's rather tedious to fix the issue. No function checks the return value of internal_setblocking()...
It's a bit tedious, but not too bad. The attached patch appears to work, but needs review (especially for the Windows and VMS branches in internal_setblocking. This changes the return value of internal_setblocking, it was unconditionally 1 and is now -1 if the call fails and 0 otherwise.