This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mkstemp doesn't return abspath
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: anthonybaxter, loewis, midramas, quiver
Priority: normal Keywords:

Created on 2003-09-22 05:26 by quiver, last changed 2022-04-10 16:11 by admin. This issue is now closed.

Messages (5)
msg18244 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2003-09-22 05:26
The document of tempfile.mkstemp says that,
"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, if you specify the directory a relative path,
it doesn't return an absolute pathname.

>>> import tempfile
>>> tempfile.mkstemp()
(5, '/tmp/tmpHBq8rz')
>>> tempfile.mkstemp(dir='.')
(3, './tmpvK7BEr')
>>> tempfile.mkstemp(dir='./test')
(4, './test/tmplB7GZF')
msg18245 - (view) Author: Anthony Baxter (anthonybaxter) (Python triager) Date: 2003-09-23 11:03
Logged In: YES 
user_id=29957

Anyone got an opinion on this one? Should the docs be fixed,
or the code?
msg18246 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2003-09-23 11:34
Logged In: YES 
user_id=671362

Michael has submitted a patch to return absolute 
pathname.

http://www.python.org/sf/810914
fix for mkstemp with relative paths (bug #810408)

His fix looks good to me.
msg18247 - (view) Author: Michael Bartl (midramas) Date: 2003-09-24 13:01
Logged In: YES 
user_id=31511

As I have written the patch, my comment:

I think the code should be fixed, because the filename is 
instantly usable if returned with an absolute path. If the 
patch is not accepted please consider to use at least the 
additional testcase which catches the bug.
msg18248 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2003-10-12 17:38
Logged In: YES 
user_id=21627

Fixed with #810914.
History
Date User Action Args
2022-04-10 16:11:17adminsetgithub: 39269
2003-09-22 05:26:04quivercreate