Message276395
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') |
|
Date |
User |
Action |
Args |
2016-09-14 08:09:53 | christian.heimes | set | recipients:
+ christian.heimes, r.david.murray, martin.panter |
2016-09-14 08:09:53 | christian.heimes | set | messageid: <1473840593.84.0.105742370529.issue28134@psf.upfronthosting.co.za> |
2016-09-14 08:09:53 | christian.heimes | link | issue28134 messages |
2016-09-14 08:09:53 | christian.heimes | create | |
|