[issue12760] Add create mode to open()

Éric Araujo report at bugs.python.org
Fri Dec 30 21:59:05 CET 2011


Éric Araujo <merwok at netwok.org> added the comment:

> This is not a "duplicate issue". The openat solution is no easier than the os.open
> solution.

Amaury did not suggest to use openat, but the new opener argument to open, which was especially added for use cases such as the one discussed here:

    ...
    open_exclusive = lambda path, mode: os.open(path, mode|os.O_CREAT|os.O_EXCL))
    ...
    fp = open(filename, 'w', opener=open_exclusive)
    ...

That’s why this bug was initially closed as duplicate.

----------

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


More information about the Python-bugs-list mailing list