STINNER Victor added the comment: socketserver_close_on_exec.patch: - Add TCPServer.close_on_exec class attribute: True by default if the fcntl module is present, False otherwise - Use SOCK_CLOEXEC if present, fcntl() + FD_CLOEXEC otherwise
Even if SOCK_CLOEXEC is present, fcntl() is used to check the flag "works" (if FD_CLOEXEC was set). If SOCK_CLOEXEC works, fcntl() will not be called anymore, otherwise we fall back to fcntl() + FD_CLOEXEC. I implemented this fallback for Linux older than 2.6.27. I don't know if SOCK_CLOEXEC is simply ignored, as Linux did for O_CLOEXEC, but I don't have such old Linux version to test. I chose to set close-on-exec flag *by default*. If we chose to disable it by default, the following changes should be done on my patch: - TCPServer.close_on_exec : "close_on_exec = (fcntl is not None)" => "close_on_exec = False" - SimpleXMLRPCServer: add close_on_exec class attribute, "close_on_exec = (fcntl is not None)" (and restore try/except ImportError for fcntl) ---------- keywords: +patch Added file: http://bugs.python.org/file28640/socketserver_close_on_exec.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12107> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com