This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Christophe.Devriese, gregory.p.smith, nadeem.vawda, neologix, pitrou, vstinner
Date 2013-01-09.00:07:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
 - 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)
Date User Action Args
2013-01-09 00:07:18vstinnersetrecipients: + vstinner, gregory.p.smith, pitrou, nadeem.vawda, neologix, Christophe.Devriese
2013-01-09 00:07:17vstinnersetmessageid: <>
2013-01-09 00:07:17vstinnerlinkissue12107 messages
2013-01-09 00:07:17vstinnercreate