[issue12105] open() does not able to set flags, such as O_CLOEXEC
Charles-François Natali
report at bugs.python.org
Fri May 20 11:18:11 CEST 2011
Charles-François Natali <neologix at free.fr> added the comment:
> To exclude races (in concurrent threads), this two ops should be done under lock (GIL?)
That won't work, because open(), like other slow syscalls, is called without the GIL held. Furthermore, it wouldn't be atomic anyway (imagine a fork is done from a C extension without the GIL held).
So we would end up tricking people into using a 'e' flag that, contrarily to GNU fopen(), would not be atomic.
Since the fopen() 'e' flag is only available on platform supporting O_CLOEXEC, you're exactly as portable using the fdopen() trick. And you're sure of what's happening.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12105>
_______________________________________
More information about the Python-bugs-list
mailing list