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, martin.panter, pitrou, r.david.murray, vstinner, yselivanov
Date 2017-12-29.23:42:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1514590938.55.0.213398074469.issue28134@psf.upfronthosting.co.za>
In-reply-to
Content
Yuri,

* The patch is purely about Python's view of the socket. The actual behavior of the OS socket fd is not influenced by socket.socket()'s family, type and protocol. However the especially the family is critical for Python because a lot of socket code uses the family to decide how to format its address or the peer address.

* On some platforms and/or for some socket types, it is not possible to get the address family or type unless connect() or bind() have been called. On Linux it seems to work for both new sockets and bound/connected sockets. On Windows it never works for a fresh socket.

* It looks like Windows doesn't have protocol dedicated and always uses 0 as protocols.

* Using the wrong type is less of an issue. Using the wrong family is really really bad, see https://bugs.python.org/issue28134#msg285972.

* I don't care much about validating the values. I'm concerned to have correct values by default. Validation can be implemented in a separate PR. In that case we want to add socket.closefd(fd: int). On Windows os.close() can't be used for socket fds.
History
Date User Action Args
2017-12-29 23:42:18christian.heimessetrecipients: + christian.heimes, pitrou, vstinner, r.david.murray, martin.panter, yselivanov
2017-12-29 23:42:18christian.heimessetmessageid: <1514590938.55.0.213398074469.issue28134@psf.upfronthosting.co.za>
2017-12-29 23:42:18christian.heimeslinkissue28134 messages
2017-12-29 23:42:18christian.heimescreate