[issue18643] add a fallback socketpair() implementation in test.support

STINNER Victor report at bugs.python.org
Wed Jul 23 22:41:50 CEST 2014


STINNER Victor added the comment:

> Barring any objection, I'll commit the patch attached within a couple days.

I have objections!

You should copy the code from asyncio.windows_utils.socketpair(). It checks also type and proto parameter: raise a ValueError for unsupported values (only SOCK_STREAM and proto=0 are supported). It also supports IPv6. It handles BlockingIOError and InterruptedError on connect (I never understood why these exceptions are simply ignored).

You patch checks the address received by accept() and retry. It's a little bit surprising. If you get an unexpected connection, maybe an exception should be raised, instead of just ignoring it. Maybe we should modify the code in asyncio to check also the address?

Finally, please add socketpair() directly to the socket module. It is useful for applications, not only for tests.

A socket.socketpair() function available on Windows would help me to write tests for the issue #22018!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18643>
_______________________________________


More information about the Python-bugs-list mailing list