[Python-Dev] PEP 446: issue with sockets

Victor Stinner victor.stinner at gmail.com
Wed Aug 21 14:50:51 CEST 2013


2013/8/21 Richard Oudkerk <shibturn at gmail.com>:
> On 21/08/2013 1:19am, Victor Stinner wrote:
>> I don't know if a socket handle is similar to file handles or if they
>> are specials. At least, GetHandleInformation() and
>> SetHandleInformation() functions, used by
>> os.get/set_handle_inheritable(), accept socket handles.
>
> Anti-virus software and firewalls can stop SetHandleInformation() from
> working properly on sockets:
>
> http://stackoverflow.com/questions/12058911/can-tcp-socket-handles-be-set-not-inheritable

Yeah, I know, I already added the link to the PEP.

I improved the implementation of the PEP 446: it now uses the
WSA_FLAG_NO_HANDLE_INHERIT flag when it is available (Windows 7 SP1
and Windows Server 2008 R2 SP1, which is probably a minor percentage
of Windows installations).

On older Windows versions, I don't see what Python can do to
workaround the issue except of calling SetHandleInformation() on the
result of WSASocket().

Victor


More information about the Python-Dev mailing list