mirror of
https://github.com/python/cpython.git
synced 2026-01-26 21:03:34 +00:00
gh-142302: Fix mkstemp() documentation: clarify file descriptor inheritance behavior (#142338)
The documentation incorrectly stated that the file descriptor is not inherited by child processes. In reality, the close-on-exec flag (when available) only prevents inheritance across exec() calls, not fork(). Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
8735daf3e8
commit
e79c9b7031
@ -1979,7 +1979,8 @@ can be inherited by child processes. Since Python 3.4, file descriptors
|
||||
created by Python are non-inheritable by default.
|
||||
|
||||
On UNIX, non-inheritable file descriptors are closed in child processes at the
|
||||
execution of a new program, other file descriptors are inherited.
|
||||
execution of a new program, other file descriptors are inherited. Note that
|
||||
non-inheritable file descriptors are still *inherited* by child processes on :func:`os.fork`.
|
||||
|
||||
On Windows, non-inheritable handles and file descriptors are closed in child
|
||||
processes, except for standard streams (file descriptors 0, 1 and 2: stdin, stdout
|
||||
|
||||
@ -225,8 +225,9 @@ The module defines the following user-callable items:
|
||||
properly implements the :const:`os.O_EXCL` flag for :func:`os.open`. The
|
||||
file is readable and writable only by the creating user ID. If the
|
||||
platform uses permission bits to indicate whether a file is executable,
|
||||
the file is executable by no one. The file descriptor is not inherited
|
||||
by child processes.
|
||||
the file is executable by no one.
|
||||
|
||||
The file descriptor is :ref:`not inherited by child processes <fd_inheritance>`.
|
||||
|
||||
Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible
|
||||
for deleting the temporary file when done with it.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user