Issue 635656: os.tempnam behavior in Windows (original) (raw)

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.