[Python-bugs-list] [ python-Bugs-810408 ] mkstemp doesn't return abspath

SourceForge.net noreply at sourceforge.net
Wed Sep 24 09:01:39 EDT 2003


Bugs item #810408, was opened at 2003-09-22 07:26
Message generated for change (Comment added) made by midramas
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=810408&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Nobody/Anonymous (nobody)
Summary: mkstemp doesn't return abspath

Initial Comment:
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')



----------------------------------------------------------------------

Comment By: Michael Bartl (midramas)
Date: 2003-09-24 15:01

Message:
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.

----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2003-09-23 13:34

Message:
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.

----------------------------------------------------------------------

Comment By: Anthony Baxter (anthonybaxter)
Date: 2003-09-23 13:03

Message:
Logged In: YES 
user_id=29957

Anyone got an opinion on this one? Should the docs be fixed,

or the code?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=810408&group_id=5470



More information about the Python-bugs-list mailing list