Message276363
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)? |
|
Date |
User |
Action |
Args |
2016-09-14 00:07:59 | martin.panter | set | recipients:
+ martin.panter, christian.heimes, r.david.murray |
2016-09-14 00:07:59 | martin.panter | set | messageid: <1473811679.43.0.678970176694.issue28134@psf.upfronthosting.co.za> |
2016-09-14 00:07:59 | martin.panter | link | issue28134 messages |
2016-09-14 00:07:59 | martin.panter | create | |
|