[issue16850] Atomic open + close-and-exec

STINNER Victor report at bugs.python.org
Fri Jan 4 15:30:25 CET 2013


STINNER Victor added the comment:

Here is a work-in-progress patch to test my idea: add "e" flag to open().

Limitations/TODO:

 * The unit test doesn't work on Windows (it requires fcntl)
 * "e" mode and the opener argument are exclusive: if O_CLOEXEC and O_NOINHERINT are missing, I don't see how the opener can be aware of the "e" flag. Or should we call fcntl(F_SETFD, flags|FD_CLOEXEC) after the opener? It would be strange: the opener is supposed to be the only one to decide how the file is opened, isn't it?
 * NotImplementedError is raised if O_CLOEXEC, O_NOINHERIT and fcntl() are missing

I only tested my patch on Linux (3.6).

----------
keywords: +patch
Added file: http://bugs.python.org/file28561/open_mode_e.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16850>
_______________________________________


More information about the Python-bugs-list mailing list