This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tempfile.mkstempf
Type: Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, ncoghlan, ndparker, skip.montanaro
Priority: normal Keywords: easy, patch

Created on 2008-04-29 02:11 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
mkstempf.diff skip.montanaro, 2008-04-29 11:50
Messages (7)
msg65951 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-04-29 02:11
On python-dev Guido lamented the fact that tempfile.mkstemp()
returns a file descriptor instead of a file object.  This
patch adds tempfile.mkstempf to remedy that.
msg65961 - (view) Author: André Malo (ndparker) * Date: 2008-04-29 11:25
It should catch OSError on fdopen, close fd and reraise, I think.
msg65964 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-04-29 11:50
Thanks.  New patch attached.
msg65965 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-04-29 12:24
What does this offer over using NamedTemporaryFile(delete=False)?
msg65966 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-04-29 13:54
Nick> What does this offer over using NamedTemporaryFile(delete=False)?

Nothing I suppose.  I wasn't aware of the similarity of the two (I always
use mkstemp()) or the delete arg to NamedTemporaryFile, and assumed Guido's
complaint about mkstemp's shortcoming indicated that the functionality he
desired didn't exist.

Skip
msg65972 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2008-04-29 15:40
The delete flag on NamedTemporaryFile is new for 2.6, so it isn't
surprising people aren't familiar with it. The other advantage of using
NamedTemporaryFile is that its name attribute is set correctly, which
isn't the case when using mkstemp directly.
msg66392 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2008-05-08 02:28
The conclusion on python-dev is that NamedTemporaryFile is
an adequate replacement for mktemp, so this isn't needed.
History
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46969
2008-05-08 02:28:23skip.montanarosetstatus: open -> closed
resolution: rejected
messages: + msg66392
keywords: patch, patch, easy
2008-04-30 13:14:00giampaolo.rodolasetnosy: + giampaolo.rodola
2008-04-29 15:40:35ncoghlansetkeywords: patch, patch, easy
messages: + msg65972
2008-04-29 13:55:22skip.montanarosetmessages: + msg65966
2008-04-29 12:25:10ncoghlansetkeywords: patch, patch, easy
nosy: + ncoghlan
messages: + msg65965
2008-04-29 11:51:26skip.montanarosetfiles: - mkstempf.diff
2008-04-29 11:50:38skip.montanarosetkeywords: patch, patch, easy
files: + mkstempf.diff
messages: + msg65964
2008-04-29 11:25:37ndparkersetnosy: + ndparker
messages: + msg65961
2008-04-29 02:11:28skip.montanarocreate