[Python-checkins] cpython: Issue #16860: In tempfile, use O_CLOEXEC when available to set the
charles-francois.natali
python-checkins at python.org
Fri Jan 4 18:33:35 CET 2013
http://hg.python.org/cpython/rev/64883c614c88
changeset: 81282:64883c614c88
parent: 81280:fee4bc043d73
user: Charles-François Natali <neologix at free.fr>
date: Fri Jan 04 18:33:02 2013 +0100
summary:
Issue #16860: In tempfile, use O_CLOEXEC when available to set the
close-on-exec flag atomically.
files:
Lib/tempfile.py | 2 ++
Misc/NEWS | 3 +++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -57,6 +57,8 @@
_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'):
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -204,6 +204,9 @@
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.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list