Christian Heimes added the comment:

I'm well aware that it does not work in all cases. However it works good enough 
in most cases. Right now the fileno argument must be considered broken because 
it leads to wrong results. It is a problem and possible security issue for a 
couple of use cases, e.g. passing of sockets through AF_UNIX AUX data or 
systemd socket activation.

On Windows it is less problematic because socket(filno) works correctly with 
WSAPROTOCOL_INFO. It's only broken for integer fd.

I have considered to set type, family and proto to 0 (unspec) when the 
getsockopt and getsockname fail.

I have a differnt ticket for the protocol issue, #27816.


Python tracker <>
Python-bugs-list mailing list

Reply via email to