[Python-checkins] cpython (merge 3.5 -> default): Merge 3.5

victor.stinner python-checkins at python.org
Tue Oct 20 18:15:26 EDT 2015


https://hg.python.org/cpython/rev/89d00c0a9eae
changeset:   98816:89d00c0a9eae
parent:      98814:c3cec0f77eff
parent:      98815:dc2deecb2346
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Oct 21 00:15:17 2015 +0200
summary:
  Merge 3.5

files:
  Lib/tempfile.py |  12 ++++++++++--
  1 files changed, 10 insertions(+), 2 deletions(-)


diff --git a/Lib/tempfile.py b/Lib/tempfile.py
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -591,12 +591,20 @@
                 flags2 = (flags | _os.O_TMPFILE) & ~_os.O_CREAT
                 fd = _os.open(dir, flags2, 0o600)
             except IsADirectoryError:
-                # Linux kernel older than 3.11 ignores O_TMPFILE flag.
-                # Set flag to False to not try again.
+                # Linux kernel older than 3.11 ignores the O_TMPFILE flag:
+                # O_TMPFILE is read as O_DIRECTORY. Trying to open a directory
+                # with O_RDWR|O_DIRECTORY fails with IsADirectoryError, a
+                # directory cannot be open to write. Set flag to False to not
+                # try again.
                 _O_TMPFILE_WORKS = False
             except OSError:
                 # The filesystem of the directory does not support O_TMPFILE.
                 # For example, OSError(95, 'Operation not supported').
+                #
+                # On Linux kernel older than 3.11, trying to open a regular
+                # file (or a symbolic link to a regular file) with O_TMPFILE
+                # fails with NotADirectoryError, because O_TMPFILE is read as
+                # O_DIRECTORY.
                 pass
             else:
                 try:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list