Christian Heimes added the comment:

Martin, the documentation says "If fileno is specified, the other arguments are 
ignored, causing the socket with the specified file descriptor to return." It's 
a direct quote from Python 3's socket library documentation. For a non-native 
speaker like me, this sentence implies that socket.socket(fileno) not only 
ignores the arguments (which it does not) but that the constructor uses the 
fileno to set family, type and proto.

The socket module uses self->sock_family in several places to calculate the 
addr len or when it handles arguments and address information. Just look at 
this simple example:

>>> import socket
>>> uds = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> s = socket.socket(fileno=uds.fileno())
>>> s.bind('/tmp/sock')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: getsockaddrarg: AF_INET address must be tuple, not str
>>> uds.bind('/tmp/sock')

----------

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

Reply via email to