Issue 2717: tempfile.mkstempf - Python tracker (original) (raw)

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: Alyssa 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: Alyssa 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:33 admin set github: 46969
2008-05-08 02:28:23 skip.montanaro set status: open -> closedresolution: rejectedmessages: + keywords:patch, patch, easy
2008-04-30 13:14:00 giampaolo.rodola set nosy: + giampaolo.rodola
2008-04-29 15:40:35 ncoghlan set keywords:patch, patch, easymessages: +
2008-04-29 13:55:22 skip.montanaro set messages: +
2008-04-29 12:25:10 ncoghlan set keywords:patch, patch, easynosy: + ncoghlanmessages: +
2008-04-29 11:51:26 skip.montanaro set files: - mkstempf.diff
2008-04-29 11:50:38 skip.montanaro set keywords:patch, patch, easyfiles: + mkstempf.diffmessages: +
2008-04-29 11:25:37 ndparker set nosy: + ndparkermessages: +
2008-04-29 02:11:28 skip.montanaro create