Le Fri, 25 Jan 2013 12:28:10 +0100, Victor Stinner <victor.stin...@gmail.com> a écrit : > > I think the default behaviour needs to be configurable from the > > environment and the command line, but I don't believe it should be > > configurable from within the interpreter. > > sys.setdefaultcloexec() is convinient for unit test, but it may also > be used by modules. A web framework may want to enable close-on-exec > flag by default. > > The drawback of changing the default value after Python started is > that Python may have created file descriptors before, so you cannot > guarantee that all existing file descriptors have the flag set. > > 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). Regards Antoine. _______________________________________________ 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