Skip to content

Commit 9f8129a

Browse files
sirosenpicnic-sven
authored andcommitted
gh-94543: Improve tempfile.mkstemp documentation about cleanup (GH-154748)
(cherry picked from commit 60b9cf8) Co-authored-by: Stephen Rosen <sirosen0@gmail.com> Co-authored-by: picnic-sven <88426829+picnic-sven@users.noreply.github.com>
1 parent 852d804 commit 9f8129a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Doc/library/tempfile.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ The module defines the following user-callable items:
228228
The file descriptor is :ref:`not inherited by child processes <fd_inheritance>`.
229229

230230
Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible
231-
for deleting the temporary file when done with it.
231+
for closing the file descriptor (for example, using :func:`os.close`) and
232+
deleting the temporary file (for example, using :func:`os.remove`).
232233

233234
If *suffix* is not ``None``, the file name will end with that suffix,
234235
otherwise there will be no suffix. :func:`mkstemp` does not put a dot

0 commit comments

Comments
 (0)