gh-94543: Improve tempfile.mkstemp documentation about cleanup (#154748)

hugovk <[email protected]> Thu, 30 Jul 2026 16:42:44 -0400 (EDT)
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/60b9cf84117567c5df63482d9fbf68db3d7ef74e
commit: 60b9cf84117567c5df63482d9fbf68db3d7ef74e
branch: main
author: Stephen Rosen <[email protected]>
committer: hugovk <[email protected]>
date: 2026-07-30T23:42:32+03:00
summary:

gh-94543: Improve tempfile.mkstemp documentation about cleanup (#154748)

Co-authored-by: picnic-sven <[email protected]>

files:
M Doc/library/tempfile.rst

diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst
index 8c387853d0417f..9b89cb92594ea6 100644
--- a/Doc/library/tempfile.rst
+++ b/Doc/library/tempfile.rst
@@ -257,7 +257,8 @@ The module defines the following user-callable items:
    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.
+   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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]