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 yselivanov
Recipients christian.heimes, martin.panter, pitrou, r.david.murray, vstinner, yselivanov
Date 2017-12-16.00:21:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513383710.74.0.213398074469.issue28134@psf.upfronthosting.co.za>
In-reply-to
Content
Let's quickly iterate over what's possible first:

* It's possible to check the type of the FD using "getsockopt(SOL_SOCKET, SO_TYPE)" on all platforms.

* It's possible to check family/proto of the FD using "getsockopt(SOL_SOCKET, SO_DOMAIN/SO_PROTOCOL)" on Linux.

Given the above I propose the following:

1. Passing a wrong type can be considered as a serious error.  SOCK_STREAM is fundamentally different from SOCK_DGRAM.  Because we have a way to validate socket type on all platforms, I propose to do this validation when we create a socket from an FD, and raise an error if the passed socket type isn't correct.

2. When Python is running with '-X dev' (new dev mode added by Victor), I propose to also validate socket.family and socket.proto on Linux, and raise a RuntimeWarning when they don't match.
History
Date User Action Args
2017-12-16 00:21:50yselivanovsetrecipients: + yselivanov, pitrou, vstinner, christian.heimes, r.david.murray, martin.panter
2017-12-16 00:21:50yselivanovsetmessageid: <1513383710.74.0.213398074469.issue28134@psf.upfronthosting.co.za>
2017-12-16 00:21:50yselivanovlinkissue28134 messages
2017-12-16 00:21:50yselivanovcreate