[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

STINNER Victor report at bugs.python.org
Sun May 18 11:52:48 CEST 2014


STINNER Victor added the comment:

tempfile_o_tmpfile2.patch: Updated patch to handle OS errors.

I'm not sure that __O_TMPFILE has the same value on all architectures.

The O_TMPFILE flag was added to fcntl.h in the glibc 2.19 (released the 8 Feb 2014):
https://sourceware.org/git/?p=glibc.git;a=commit;h=ffdd31816a67f48697ea4d6b852e58d2886d42ca

My Linux Fedora 20 uses the glibc 2.18.

I removed the hardcoded constant from my patch. Add this to Lib/tempfile.py to test manually if you have a glibc older than 2.19:

# after "if hasattr(_os, 'O_TMPFILE'):"
elif _sys.platform == 'linux':
    __O_TMPFILE = 0o20000000
    _O_TMPFILE = (__O_TMPFILE | _os.O_DIRECTORY)

----------
Added file: http://bugs.python.org/file35276/tempfile_o_tmpfile2.patch

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


More information about the Python-bugs-list mailing list