On 21/08/2013 1:50pm, Victor Stinner wrote:
2013/8/21 Richard Oudkerk <shibt...@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


If the socket methods are not guaranteed to work then they should come with a nice big warning to that effect.

It seems that the only reliable way for a parent process to give a socket to a child process is to use WSADuplicateSocket(). (But that requires communication between parent and child after the child has started.)

--
Richard
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to