Justin Cappos <justincap...@gmail.com> added the comment:

> Apparently, the designers of BSD thought differently. Remember that
> it is them who defined the socket API in the first place, so they
> have the right that their design decisions are considered.

I think there is a bit of confusion here.   The 'bug' isn't with different 
socket semantics on different OSes.   The bug is that the programmer who wrote 
the wrapper for sockets on Python assumed the OS semantics weren't the BSD 
style.   


Here is the issue (put plainly):

Python sockets support a notion of timeout  (note this notion is not reflected 
in the OS socket API).

The python socket implementation of timeouts uses the underlying OS / socket 
API to provide this by setting the socket to nonblocking and setting a timeout 
value in a Python object that holds socket info.

This implementation assumes that the OS sets any socket it receives via accept 
to nonblocking.   (this is a false assumption on BSD)

The end result is that the OS has a nonblocking socket and the Python object 
thinks it is blocking.   This is why the socket object in Python has 
timeout=None yet calling fcntl shows the socket is nonblocking.

Calling code paths that handle timeouts and expect the socket to block causes 
bugs like I described in my code.   This behavior is clearly wrong under any 
interpretation!


You can debate whether the right patch is to use what I proposed or instead 
change new Python sockets to inherit the timeout / blocking setting on BSD.   
However, what is implemented now is clearly broken.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7995>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to