Skip to content

Commit 667e5b6

Browse files
committed
Clarify mkstemp() fd inheritance is specific to exec() calls
The original documentation stated 'The file descriptor is not inherited by child processes' without clarifying that this only applies to exec() calls due to O_CLOEXEC (set via PEP 446). The fd is still inherited and usable after fork() before exec(). Update documentation to specifically mention exec() calls for accuracy
1 parent 220c5d0 commit 667e5b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Doc/library/tempfile.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ The module defines the following user-callable items:
227227
platform uses permission bits to indicate whether a file is executable,
228228
the file is executable by no one.
229229

230-
The file descriptor will be inherited by child processes.
230+
The file descriptor is not inherited by child processes across
231+
:func:`exec <os.execl>` calls.
231232

232233
Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible
233234
for deleting the temporary file when done with it.

0 commit comments

Comments
 (0)