Skip to content

bpo-42830: Update the documentation for tempfile.mkstemp #27075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Doc/library/tempfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ The module defines the following user-callable items:
by child processes.

Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible
for deleting the temporary file when done with it.
for deleting the temporary file when done with it. If a large number of file
descriptors are created, your program may run into a per-process limit and raise an :exc:`OSError`.
You can avoid this issue by closing file descriptors with :func:`os.close`.
Comment on lines +165 to +167
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just say something like "the user of :func:mskstemp is responsible for deleting the temporary file and closing the file descriptor". Lots of things can cause you to run out of FDs, this isn't the place to describe the exact behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.


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
Expand Down