[issue1318] Remove os.tmpnam() and os.tempnam()

Martin v. Löwis report at bugs.python.org
Thu Oct 25 19:12:03 CEST 2007


Martin v. Löwis added the comment:

> os.tmpfile() is the only method that has no duplicate in tempfile.

Why do you say that? tempfile.mkstemp() does essentially the same
as os.tmpfile().

> The promise of tempfile.mkstemp is also bogus for every OS except
> Windows. IIRC only Windows supports O_NOINHERIT.

Please read the code. It tries to set the CLOEXEC flag on Unix,
which should work on most systems.

> Let me rephrase the rational for my patch: I want to remove duplicate
> code to have just but one implementation to create a temporary file
> (name). I want the one implementation be under our control and not
> depend on some possible broken or stupid C library like Windows where
> tmpnam may create the temporary files in C:\. I want an unified way to
> get the TEMP dir independent of the API.

As I said, I agree with most of this rationale, except that I'm
uncertain whether it is good to trade a stupid C library for a
stupid Python implementation.

With this rationale, again, I think tmpfile should be removed as
well.

Regards,
Martin

----------
title: Remove os.tmpnam() and os.tempnam() [patch] -> Remove os.tmpnam() and os.tempnam()

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1318>
__________________________________


More information about the Python-bugs-list mailing list