Bugs item #922922, was opened at 2004-03-25 06:06
Message generated for change (Comment added) made by otterley
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=922922&group_id=5470
Category: Python Library
Group: Python 2.3
Resolution: None
Priority: 5
Submitted By: Michael S. Fischer (otterley)
Assigned to: Nobody/Anonymous (nobody)
Summary: tempfile.mkstemp() documentation discrepancy
Initial Comment:
The documentation for tempfile.mkstemp() at
http://www.python.org/doc/2.3.3/lib/module-
tempfile.html (as well as the ActivePython
documentation that ships with the Windows 2.3 build)
says:
"mkstemp() returns a tuple containing an OS-level
handle to an open file (as would be returned by os.open
()) and the absolute pathname of that file, in that order."
However, whenever I use it, it returns a tuple containing
an integer (presumably the file descriptor) and the
absolute pathname of the tempfile. No file handle is
returned.
Sure enough, the in-line documentation states:
"The return value is a pair (fd, name) where fd is the file
descriptor returned by os.open, and name is the
filename."
Could someone please correct this discrepancy?
----------------------------------------------------------------------
Comment By: Michael S. Fischer (otterley)
Date: 2004-03-27 02:32
Message:
Logged In: YES
user_id=7820
The documentation could be a bit clearer. When I think of a
file descriptor in python, I think of a file-like object, i.e. that
which is returned by open(), as opposed to os.open().
It's unclear to me why mkstemp() returns an os-level file
descriptor as opposed to a Python file-like object, but I
suppose that's beside the point.
I'll close the bug, though, because the documentation is
literally correct, and the team has more urgent priorities.
----------------------------------------------------------------------
Comment By: Nick Bastin (mondragon)
Date: 2004-03-26 18:47
Message:
Logged In: YES
user_id=430343
As noted in the os.open() documentation, it returns a
file descriptor, which seems to make the mkstemp()
documentation perfectly reasonable (and correct).
----------------------------------------------------------------------