summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-14 15:41:26 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-14 15:41:26 (GMT)
commit04490bf225a821455cd89821479bd0277dcbb3dc (patch)
tree3fc079d40a53b80f066c68ba2c17e357878b5d9f
parent5c08a99b77e371b23ca7b06407c1c8ac6616b8df (diff)
downloadcpython-04490bf225a821455cd89821479bd0277dcbb3dc.zip
cpython-04490bf225a821455cd89821479bd0277dcbb3dc.tar.gz
cpython-04490bf225a821455cd89821479bd0277dcbb3dc.tar.bz2
tempfile's mkstemp(): Changed last argument from
binary=True to text=False by BDFL Pronouncement. All other changes follow from this. The change to the docs is ready to go, but blocked by another JackMacLock in the doc directory.
-rw-r--r--Lib/tempfile.py20
-rw-r--r--Lib/test/test_pkg.py2
2 files changed, 11 insertions, 11 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 5ab5433..900222f 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -250,8 +250,8 @@ def gettempdir():
_once('tempdir', _get_default_tempdir)
return tempdir
-def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=True):
- """mkstemp([suffix, [prefix, [dir, [binary]]]])
+def mkstemp(suffix="", prefix=template, dir=gettempdir(), text=False):
+ """mkstemp([suffix, [prefix, [dir, [text]]]])
User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
@@ -265,9 +265,9 @@ def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=True):
If 'dir' is specified, the file will be created in that directory,
otherwise a default directory is used.
- If 'binary' is specified and false, the file is opened in text
- mode. Otherwise, the file is opened in binary mode. On some
- operating systems, this makes no difference.
+ 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.
The file is readable and writable only by the creating user ID.
If the operating system uses permission bits to indicate whether a
@@ -277,10 +277,10 @@ def mkstemp(suffix="", prefix=template, dir=gettempdir(), binary=True):
Caller is responsible for deleting the file when done with it.
"""
- if binary:
- flags = _bin_openflags
- else:
+ if text:
flags = _text_openflags
+ else:
+ flags = _bin_openflags
return _mkstemp_inner(dir, prefix, suffix, flags)
@@ -290,7 +290,7 @@ def mkdtemp(suffix="", prefix=template, dir=gettempdir()):
User-callable function to create and return a unique temporary
directory. The return value is the pathname of the directory.
- Arguments are as for mkstemp, except that the 'binary' argument is
+ Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
The directory is readable, writable, and searchable only by the
@@ -319,7 +319,7 @@ def mktemp(suffix="", prefix=template, dir=gettempdir()):
User-callable function to return a unique temporary file name. The
file is not created.
- Arguments are as for mkstemp, except that the 'binary' argument is
+ Arguments are as for mkstemp, except that the 'text' argument is
not accepted.
This function is unsafe and should not be used. The file name
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py
index 36ea95c..919a019 100644
--- a/Lib/test/test_pkg.py
+++ b/Lib/test/test_pkg.py
@@ -56,7 +56,7 @@ def runtest(hier, code):
root = tempfile.mkdtemp()
mkhier(root, hier)
savepath = sys.path[:]
- fd, fname = tempfile.mkstemp(binary=False)
+ fd, fname = tempfile.mkstemp(text=True)
os.write(fd, code)
os.close(fd)
try: