[issue1318] Remove os.tmpnam() and os.tempnam() [patch]
report at bugs.python.org
Thu Oct 25 11:44:29 CEST 2007
Christian Heimes added the comment:
os.tmpfile() is the only method that has no duplicate in tempfile. I
chose to keep it for this very reason. But you made good point, too.
What do you think about renaming tmpfile to _tmpfile and make it
available from the tempfile module as tempfile.tmpfile()?
I totally agree with your opinion on tmpnam and tempnam. As far as I
know it's impossible to prevent a child process from doing something
harmful. The child must be mature enough to do the right think and open
a file with the correct flags.
The promise of tempfile.mkstemp is also bogus for every OS except
Windows. IIRC only Windows supports O_NOINHERIT.
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.
Tracker <report at bugs.python.org>
More information about the Python-bugs-list