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
Date 2016-09-13.19:13:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Documentation of socket.socket(fileno) 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>
>>> ==
>>> 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:31christian.heimessetrecipients: + christian.heimes
2016-09-13 19:13:31christian.heimessetmessageid: <>
2016-09-13 19:13:31christian.heimeslinkissue28134 messages
2016-09-13 19:13:31christian.heimescreate