mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
Issue #25064: Adjust documentation according to new mkstemp signature
The mkstemp() and mkdtemp() signatures have already been updated, but the higher-level functions still suggest that the default values are forced to text strings. Also merged some paragraphs describing the "suffix" and "prefix" parameters, and pointed out that mktemp() does not support the new changes.
This commit is contained in:
parent
97f46db904
commit
9b566c324d
2 changed files with 26 additions and 27 deletions
|
|
@ -307,22 +307,22 @@ def mkstemp(suffix=None, prefix=None, dir=None, text=False):
|
|||
file. The return value is a pair (fd, name) where fd is the
|
||||
file descriptor returned by os.open, and name is the filename.
|
||||
|
||||
If 'suffix' is specified, the file name will end with that suffix,
|
||||
If 'suffix' is not None, the file name will end with that suffix,
|
||||
otherwise there will be no suffix.
|
||||
|
||||
If 'prefix' is specified, the file name will begin with that prefix,
|
||||
If 'prefix' is not None, the file name will begin with that prefix,
|
||||
otherwise a default prefix is used.
|
||||
|
||||
If 'dir' is specified, the file will be created in that directory,
|
||||
If 'dir' is not None, the file will be created in that directory,
|
||||
otherwise a default directory is used.
|
||||
|
||||
If 'text' is specified and true, the file is opened in text
|
||||
mode. Else (the default) the file is opened in binary mode. On
|
||||
some operating systems, this makes no difference.
|
||||
|
||||
suffix, prefix and dir must all contain the same type if specified.
|
||||
If they are bytes, the returned name will be bytes; str otherwise.
|
||||
A value of None will cause an appropriate default to be used.
|
||||
If any of 'suffix', 'prefix' and 'dir' are not None, they must be the
|
||||
same type. If they are bytes, the returned name will be bytes; str
|
||||
otherwise.
|
||||
|
||||
The file is readable and writable only by the creating user ID.
|
||||
If the operating system uses permission bits to indicate whether a
|
||||
|
|
@ -385,8 +385,9 @@ def mktemp(suffix="", prefix=template, dir=None):
|
|||
"""User-callable function to return a unique temporary file name. The
|
||||
file is not created.
|
||||
|
||||
Arguments are as for mkstemp, except that the 'text' argument is
|
||||
not accepted.
|
||||
Arguments are similar to mkstemp, except that the 'text' argument is
|
||||
not accepted, and suffix=None, prefix=None and bytes file names are not
|
||||
supported.
|
||||
|
||||
THIS FUNCTION IS UNSAFE AND SHOULD NOT BE USED. The file name may
|
||||
refer to a file that did not exist at some point, but by the time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue