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 martin.panter
Recipients christian.heimes, martin.panter, r.david.murray
Date 2016-09-14.00:07:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473811679.43.0.678970176694.issue28134@psf.upfronthosting.co.za>
In-reply-to
Content
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)?
History
Date User Action Args
2016-09-14 00:07:59martin.pantersetrecipients: + martin.panter, christian.heimes, r.david.murray
2016-09-14 00:07:59martin.pantersetmessageid: <1473811679.43.0.678970176694.issue28134@psf.upfronthosting.co.za>
2016-09-14 00:07:59martin.panterlinkissue28134 messages
2016-09-14 00:07:59martin.pantercreate