Martin Panter added the comment: The documentation says that the family, type and proto attributes correspond to the constructor arguments. Although it is unfortunate and quirky, I think your behaviour does match the documentation.
Do the mismatched settings cause any serious problems with socket methods, or just affect the Python-level attributes and repr()? Even without using fileno=..., you could argue that the proto attribute is not ideal: >>> s = socket() >>> s.proto 0 >>> s.getsockopt(SOL_SOCKET, SO_PROTOCOL) 6 >>> IPPROTO_TCP 6 Perhaps the way forward is to deprecate fileno=... in favour of Neil’s fromfd2() function. That would avoid any confusion about conflicting socket() constructor arguments and defaults. I.e. what does socket(AF_INET, SOCK_STREAM, fileno=unix_datagram_fd) mean, and is it equivalent to socket(filno=unix_datagram_fd)? ---------- nosy: +martin.panter _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28134> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com