diff options
author | Skip Montanaro <skip@pobox.com> | 2008-04-27 22:49:56 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2008-04-27 22:49:56 (GMT) |
commit | ea59a84244bb57156336d7e544eb0aa616734772 (patch) | |
tree | 76fe40151ac7c19ee36a35848e9ef06042693f92 /Lib | |
parent | 83101909cb8c4d0f9166c277266c0aef6389da96 (diff) | |
download | cpython-ea59a84244bb57156336d7e544eb0aa616734772.zip cpython-ea59a84244bb57156336d7e544eb0aa616734772.tar.gz cpython-ea59a84244bb57156336d7e544eb0aa616734772.tar.bz2 |
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/tempfile.py | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index e75c8fe..84ec6e0 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -39,7 +39,7 @@ if _os.name == 'mac': try: from cStringIO import StringIO as _StringIO -except: +except ImportError: from StringIO import StringIO as _StringIO try: @@ -82,8 +82,6 @@ else: template = "tmp" -tempdir = None - # Internal routines. _once_lock = _allocate_lock() @@ -259,7 +257,7 @@ def gettempprefix(): tempdir = None def gettempdir(): - """Accessor for tempdir.tempdir.""" + """Accessor for tempfile.tempdir.""" global tempdir if tempdir is None: _once_lock.acquire() @@ -271,8 +269,7 @@ def gettempdir(): return tempdir def mkstemp(suffix="", prefix=template, dir=None, text=False): - """mkstemp([suffix, [prefix, [dir, [text]]]]) - User-callable function to create and return a unique temporary + """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. @@ -309,8 +306,7 @@ def mkstemp(suffix="", prefix=template, dir=None, text=False): def mkdtemp(suffix="", prefix=template, dir=None): - """mkdtemp([suffix, [prefix, [dir]]]) - User-callable function to create and return a unique temporary + """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 'text' argument is @@ -341,8 +337,7 @@ def mkdtemp(suffix="", prefix=template, dir=None): raise IOError, (_errno.EEXIST, "No usable temporary directory name found") def mktemp(suffix="", prefix=template, dir=None): - """mktemp([suffix, [prefix, [dir]]]) - User-callable function to return a unique temporary file name. The + """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 |