[Patches] [ python-Patches-635656 ] os.tempnam behavior in Windows
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 08 Nov 2002 12:54:44 -0800
Patches item #635656, was opened at 2002-11-08 14:34
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=635656&group_id=5470
Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Roberto Lublinerman (rluble)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: os.tempnam behavior in Windows
Initial Comment:
os.tempnam behaviour under windows does no agree
with the documentation.
Under Windows Temporary location takes precedence
over specified directory, so tempnam("mydir") returns a
filename on the temporary location instead of "mydir"
Reason: tempnam is implemented under Windows as a
call to _tempname which behaves as described above
acording to MS documentation.
Change: use GetTempFileName to get the desired
behaviour.
File Modified: Modules/posixmodule.c
Error detected in: python v2.2
Corrected for Python v: 2.3
File revision: 2.271
----------------------------------------------------------------------
>Comment By: Tim Peters (tim_one)
Date: 2002-11-08 15:54
Message:
Logged In: YES
user_id=31435
Reassigned to Fred for pondering. As far as I can tell, the
Windows _tempnam is trying to emulate more-or-less
standard Unix tempnam: the first six man pages I found for
tempnam on the web say that the envar TMPDIR takes
precedence over the dir argument, if TMPDIR is writable.
That's what Windows does too, except the name of the
envar is TMP on Windows.
If that's so, the implementation of os.tempnam is entirely
unsurprising, but the Python docs need more words, to
clarify that the behavior depends on the platform C library.
Roberto, in no case do I expect to apply the patch:
changing *behavior* here is dangerous to working code,
and all signs say the function is working as intended,
although not as documented. Years of reality take
precedence over missing docs. If you need to force a
particular directoy, see the docs for the tempfile module
and its tempdir variable.
----------------------------------------------------------------------
Comment By: Tim Peters (tim_one)
Date: 2002-11-08 15:32
Message:
Logged In: YES
user_id=31435
Assigned to me.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=635656&group_id=5470