[issue16850] Add "e" mode to open(): close-and-exec (O_CLOEXEC) / O_NOINHERIT

STINNER Victor report at bugs.python.org
Mon Jan 7 23:50:00 CET 2013


STINNER Victor added the comment:

Updated patch. I tested it on Linux Fedora (3.6), Linux Debian (3.0), Windows 7, FreeBSD 8.2 (don't support O_CLOEXEC), OpenIndiana (oi_148, SunOS 5.11), OpenBSD 4.9, OpenBSD 5.2, Mac OS X 10.8. test_builtin pass on all these platforms... except OpenBSD 4.9.

The test fails on OpenBSD 4.9 for an unknown reason. fcntl(FD_CLOEXEC) + exec() works, but fcntl(FD_CLOSEXEC) + fork() + exec() fails. It looks like an OS bug, I don't see what Python can do for this case :-/ The "e" mode does correctly set FD_CLOEXEC, but FD_CLOEXEC doesn't work as expected. It's really an OS bug, because test_builtin pass on OpenBSD 5.2.

I don't have other OSes to check if another platform doesn't support "e" mode (a platform where NotImplementedError would be raised).

----------
Added file: http://bugs.python.org/file28625/open_mode_e-2.patch

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


More information about the Python-bugs-list mailing list