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 Pavel.Labath
Recipients Pavel.Labath, alex, emaste, koobs, pitrou, python-dev, rhettinger, serhiy.storchaka, vstinner
Date 2015-02-24.13:48:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424785696.56.0.593889340085.issue23458@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for fixing this.

Still, I would like to argue that an atomic operation is important. Python interpreter can run embedded in an multi-threaded application (as we do in the case of LLDB). If this is the case, then file descriptors opened by python in one thread are visible to other application threads even though they may have nothing to do with python -- they may not even know that python exists. Now if these other threads do a fork between the time you do open() and fcntl(), you've got yourself a race condition.

Granted, this is not very likely, but this is precisely the reason why O_CLOEXEC was created, and I think we should take advantage of that. And it is not even linux specific, the flag is now recent versions of mac and freebsd too. Therefore I think the original patch is better, even though it may be more complex.
History
Date User Action Args
2015-02-24 13:48:16Pavel.Labathsetrecipients: + Pavel.Labath, rhettinger, pitrou, vstinner, alex, python-dev, serhiy.storchaka, koobs, emaste
2015-02-24 13:48:16Pavel.Labathsetmessageid: <1424785696.56.0.593889340085.issue23458@psf.upfronthosting.co.za>
2015-02-24 13:48:16Pavel.Labathlinkissue23458 messages
2015-02-24 13:48:16Pavel.Labathcreate