diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-11-07 00:32:50 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-07 00:32:50 (GMT) |
commit | 9b566c324d2eb3ddbf00d5d7a78bea63cde4d15f (patch) | |
tree | f8a9a51d1b3242869926a83ee777a0d749f1e043 /Lib/tempfile.py | |
parent | 97f46db904e9887014ff3f00ddaf0813d2c05973 (diff) | |
download | cpython-9b566c324d2eb3ddbf00d5d7a78bea63cde4d15f.zip cpython-9b566c324d2eb3ddbf00d5d7a78bea63cde4d15f.tar.gz cpython-9b566c324d2eb3ddbf00d5d7a78bea63cde4d15f.tar.bz2 |
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.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index e87eb09..d381a25 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -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 |