[Python-Dev] PEP 433: Add cloexec argument to functions creating file descriptors

Victor Stinner victor.stinner at gmail.com
Thu Jan 17 14:02:45 CET 2013


2013/1/13 Jeff Allen <ja...py at farowl.co.uk>:
> I think io, meaning _io and _pyio really, would be amongst the impacted
> modules, and should perhaps be in the examples. (I am currently working on
> the Jython implementation of the _io module.) It seems to me that io.open,
> and probably all the constructors, such as _io.FileIO, would need the extra
> information as a mode or a boolean argument like closefd. This may be a
> factor in your choice above.

open() is listed in the PEP: open is io.open. I plan to add cloexec
parameter to open() and FileIO constructor (and so io.open and
_pyio.open). Examples:

rawfile = io.FileIO("test.txt", "r", cloexec=True)
textfile = open("text.txt", "r", cloexec=True)

I started an implementation, you can already test FileIO and open():
http://hg.python.org/features/pep-433

Victor


More information about the Python-Dev mailing list