From 9f8129a2bd05bab02128be3c1336eca25e8e6035 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Thu, 30 Jul 2026 15:42:32 -0500 Subject: [PATCH] gh-94543: Improve tempfile.mkstemp documentation about cleanup (GH-154748) (cherry picked from commit 60b9cf84117567c5df63482d9fbf68db3d7ef74e) Co-authored-by: Stephen Rosen Co-authored-by: picnic-sven <88426829+picnic-sven@users.noreply.github.com> --- Doc/library/tempfile.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index bf9198e175a0e11..2009bd012946a21 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -228,7 +228,8 @@ The module defines the following user-callable items: The file descriptor is :ref:`not inherited by child processes `. Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible - for deleting the temporary file when done with it. + for closing the file descriptor (for example, using :func:`os.close`) and + deleting the temporary file (for example, using :func:`os.remove`). If *suffix* is not ``None``, the file name will end with that suffix, otherwise there will be no suffix. :func:`mkstemp` does not put a dot