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 alexey-smirnov, amaury.forgeotdarc, christian.heimes, neologix, sbt, vstinner
Date 2013-01-03.15:47:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357228067.84.0.990971599555.issue16850@psf.upfronthosting.co.za>
In-reply-to
Content
> You could do both: use the O_CLOEXEC flag and do a fcntl() call on POSIX

This is the best-effort option. It was already discussed and rejected in the issue #12760.

We had a similar discussion for the PEP 418 on monotonic clock. The final decision is not only provide time.monotonic() if the OS supports monotonic clock.

Using an exception, a developer can develop its own best-effort function:

try:
    fileobj = open(filename, "e")
except NotImplementedError:
    fileobj = open(filename, "r")
    # may also fail here if the fcntl module is missing
    import fcntl
    flags = fcntl.fcntl(self.socket, fcntl.F_GETFD)
    fcntl.fcntl(fileobj, fcntl.F_SETFD, flags | fcntl.FD_CLOEXEC)

We may expose the best-effort function somewhere else, but not in open() which must be atomic in my opinion.
History
Date User Action Args
2013-01-03 15:47:47vstinnersetrecipients: + vstinner, amaury.forgeotdarc, christian.heimes, neologix, sbt, alexey-smirnov
2013-01-03 15:47:47vstinnersetmessageid: <1357228067.84.0.990971599555.issue16850@psf.upfronthosting.co.za>
2013-01-03 15:47:47vstinnerlinkissue16850 messages
2013-01-03 15:47:47vstinnercreate