[docs] [issue12760] Add create mode to open()

Charles-François Natali report at bugs.python.org
Thu Aug 18 15:24:53 CEST 2011

Charles-François Natali <neologix at free.fr> added the comment:

> The "#ifdef O_EXCL" in the source code is probably very old. Copying a message I posted on python-ideas:
> O_EXCL is a POSIX standard. It is also supported
> under Windows by the _open/_wopen compatibility functions (which we use
> for file I/O).

If it's supported by Windows then I'm OK (not that I personaly care
about Windows :-).

> and is not as easy to read as "open(file, 'c')"

Well, I'd rather have this flag called 'x', to be consistent with
glibc's fopen():

       c (since glibc 2.3.3)
              Do not make the open operation, or subsequent read and write
              operations, thread cancellation points.

       x      Open the file exclusively (like the O_EXCL flag of
open(2)).  If the
              file already exists, fopen() fails, and sets errno to
              flag is ignored for fdopen().

By the way, could you submit your patch as a mercurial diff ("hg diff")?
It makes it easier to review under Rietveld.


Python tracker <report at bugs.python.org>

More information about the docs mailing list