On Fri, Jan 25, 2013 at 10:07 PM, Nick Coghlan <ncogh...@gmail.com> wrote: > On Fri, Jan 25, 2013 at 9:36 PM, Antoine Pitrou <solip...@pitrou.net> wrote: >> Le Fri, 25 Jan 2013 12:28:10 +0100, >> Victor Stinner <victor.stin...@gmail.com> a écrit : >>> Well, I don't know if sys.setdefaultcloexec() is a good idea or >>> not :-) >> >> Both Charles-François and Nick have good points. >> sys.setdefaultcloexec() is still useful if you want to force the >> policy from a Python script's toplevel (it's more practical than >> trying to fit a command-line option in the shebang line). > > Right, I'm only -0 on that aspect. It strikes me as somewhat dubious, > but it's not obviously wrong the way a runtime equivalent of -Q or -R > would be.
I just realised I could be converted to a +0 if the runtime time switch could only be used to set the global default as "cloexec=True" and couldn't be used to switch it back again (for testing purposes, if you only want to switch it on temporarily, use a subprocess). That way, as soon as you saw "sys.setdefaultcloexec()" at the beginning of __main__, you'd know descriptors would only be inherited when cloexec=False was set explicitly. If the default flag can also be turned off globally (rather than being a one-way switch), then you have no idea what libraries might do behind your back. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ 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