This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes, martin.panter, r.david.murray
Date 2016-09-14.08:09:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473840593.84.0.105742370529.issue28134@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2016-09-14 08:09:53christian.heimessetrecipients: + christian.heimes, r.david.murray, martin.panter
2016-09-14 08:09:53christian.heimessetmessageid: <1473840593.84.0.105742370529.issue28134@psf.upfronthosting.co.za>
2016-09-14 08:09:53christian.heimeslinkissue28134 messages
2016-09-14 08:09:53christian.heimescreate