1. python_mirrors
  2. cpython

Commits

Charles-François Natali  committed 64883c6 Draft

Issue #16860: In tempfile, use O_CLOEXEC when available to set the
close-on-exec flag atomically.

  • Participants
  • Parent commits fee4bc0
  • Branches default

Comments (0)

Files changed (2)

File Lib/tempfile.py

View file
  • Ignore whitespace
 _allocate_lock = _thread.allocate_lock
 
 _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
+if hasattr(_os, 'O_CLOEXEC'):
+    _text_openflags |= _os.O_CLOEXEC
 if hasattr(_os, 'O_NOINHERIT'):
     _text_openflags |= _os.O_NOINHERIT
 if hasattr(_os, 'O_NOFOLLOW'):

File Misc/NEWS

View file
  • Ignore whitespace
 Library
 -------
 
+- Issue #16860: In tempfile, use O_CLOEXEC when available to set the
+  close-on-exec flag atomically.
+
 - Issue #16674: random.getrandbits() is now 20-40% faster for small integers.
 
 - Issue #16009: JSON error messages now provide more information.