Skip to content

Commit be9ddc1

Browse files
committed
Issue #26261: Clarify NamedTemporaryFile name attribute vs file.name
1 parent 3e85838 commit be9ddc1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Doc/library/tempfile.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ The module defines the following user-callable functions:
6464
This function operates exactly as :func:`TemporaryFile` does, except that
6565
the file is guaranteed to have a visible name in the file system (on
6666
Unix, the directory entry is not unlinked). That name can be retrieved
67-
from the :attr:`name` attribute of the file object. Whether the name can be
67+
from the :attr:`name` attribute of the returned
68+
file-like object. Whether the name can be
6869
used to open the file a second time, while the named temporary file is
6970
still open, varies across platforms (it can be so used on Unix; it cannot
7071
on Windows NT or later). If *delete* is true (the default), the file is

Lib/tempfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
455455
The file is created as mkstemp() would do it.
456456
457457
Returns an object with a file-like interface; the name of the file
458-
is accessible as file.name. The file will be automatically deleted
459-
when it is closed unless the 'delete' argument is set to False.
458+
is accessible as its 'name' attribute. The file will be automatically
459+
deleted when it is closed unless the 'delete' argument is set to False.
460460
"""
461461

462462
if dir is None:

0 commit comments

Comments
 (0)