summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-02-05 19:56:39 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-02-05 19:56:39 (GMT)
commit58af25e93008c5bd1468871a132435a5d09b6035 (patch)
tree8e58ebb31cb4630a3f5760fdd6a433ee7ddb7d67 /Doc
parent255493c81321f56afd32fb2e18d5eb3a13bed42f (diff)
parent23686074b0e665395b5b4d238663574f576cc2e3 (diff)
downloadcpython-58af25e93008c5bd1468871a132435a5d09b6035.zip
cpython-58af25e93008c5bd1468871a132435a5d09b6035.tar.gz
cpython-58af25e93008c5bd1468871a132435a5d09b6035.tar.bz2
#14515: clarify that TemporaryDirectory's __enter__ returns the name.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/tempfile.rst10
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst
index 13b6041..d78159d 100644
--- a/Doc/library/tempfile.rst
+++ b/Doc/library/tempfile.rst
@@ -97,12 +97,14 @@ The module defines the following user-callable items:
This function creates a temporary directory using :func:`mkdtemp`
(the supplied arguments are passed directly to the underlying function).
The resulting object can be used as a context manager (see
- :ref:`context-managers`). On completion of the context (or destruction
- of the temporary directory object), the newly created temporary directory
+ :ref:`context-managers`). On completion of the context or destruction
+ of the temporary directory object the newly created temporary directory
and all its contents are removed from the filesystem.
- The directory name can be retrieved from the :attr:`name` attribute
- of the returned object.
+ The directory name can be retrieved from the :attr:`name` attribute of the
+ returned object. When the returned object is used as a context manager, the
+ :attr:`name` will be assigned to the target of the :keyword:`as` clause in
+ the :keyword:`with` statement, if there is one.
The directory can be explicitly cleaned up by calling the
:func:`cleanup` method.