Message276327
Documentation of socket.socket(fileno) https://docs.python.org/3/library/socket.html#socket.socket says:
> If fileno is specified, the other arguments are ignored, causing the socket with the specified file descriptor to return.
The feature does not work. fileno does not infer the values for family, type and proto from the fd. Instead if uses the other arguments. I don't see how this feature should have ever worked on POSIX. There are no calls to getsockopt() with SO_DOMAIN, SO_TYPE and SO_PROTOCOL.
$ ./python
Python 3.7.0a0 (default:6bcedf96d25f, Sep 13 2016, 20:48:50)
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> uds = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
>>> uds
<socket.socket fd=3, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
>>> s = socket.socket(fileno=uds.fileno())
>>> s
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
>>> s.family == uds.family
False
>>> s2 = socket.socket(type=socket.SOCK_DGRAM, fileno=uds.fileno())
>>> s2
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_DGRAM, proto=0> |
|
Date |
User |
Action |
Args |
2016-09-13 19:13:31 | christian.heimes | set | recipients:
+ christian.heimes |
2016-09-13 19:13:31 | christian.heimes | set | messageid: <1473794011.65.0.923929152137.issue28134@psf.upfronthosting.co.za> |
2016-09-13 19:13:31 | christian.heimes | link | issue28134 messages |
2016-09-13 19:13:31 | christian.heimes | create | |
|