From be9ddc1d113026f9f5bd9a3f1eda1d56d47b60e8 Mon Sep 17 00:00:00 2001 From: Martin Panter Date: Mon, 22 Feb 2016 10:10:00 +0000 Subject: Issue #26261: Clarify NamedTemporaryFile name attribute vs file.name --- Doc/library/tempfile.rst | 3 ++- Lib/tempfile.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index 67eda21..fa0a27f 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -64,7 +64,8 @@ The module defines the following user-callable functions: This function operates exactly as :func:`TemporaryFile` does, except that the file is guaranteed to have a visible name in the file system (on Unix, the directory entry is not unlinked). That name can be retrieved - from the :attr:`name` attribute of the file object. Whether the name can be + from the :attr:`name` attribute of the returned + file-like object. Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later). If *delete* is true (the default), the file is diff --git a/Lib/tempfile.py b/Lib/tempfile.py index 184dfc1..8a2e9cd 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -455,8 +455,8 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", The file is created as mkstemp() would do it. Returns an object with a file-like interface; the name of the file - is accessible as file.name. The file will be automatically deleted - when it is closed unless the 'delete' argument is set to False. + is accessible as its 'name' attribute. The file will be automatically + deleted when it is closed unless the 'delete' argument is set to False. """ if dir is None: -- cgit v0.12