homepage

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.

Author sbt
Recipients brian.curtin, dabrahams, davide.rizzo, dlenski, eric.araujo, eric.smith, jaraco, ncoghlan, pitrou, r.david.murray, sbt, tim.golden
Date 2012年07月02日.13:34:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1341236077.02.0.845745751602.issue14243@psf.upfronthosting.co.za>
In-reply-to
Content
I wrote in an earlier message that a file opened with O_TEMPORARY must be reopened with O_TEMPORARY. This is not quite accurate.
Using O_TEMPORARY causes the FILE_SHARE_DELETE sharing mode to be used, and a file currently opened with FILE_SHARE_DELETE can only be reopened with FILE_SHARE_DELETE.
Unfortunately using O_TEMPORARY is the only way allowed by msvcrt to get FILE_SHARE_DELETE, even though it also has the orthogonal effect of unlinking the file when all handles are closed.
The nice thing about FILE_SHARE_DELETE is that it gives Unix-like behaviour: the file can be renamed or deleted while you have an open handle, and you can still continue to use the handle.
Attached is a mostly untested attempt at writing replacements for open() and os.open() which use the FILE_SHARE_DELETE sharing mode. Among other things, these can be used for reopening temporary files.
Even if tempfile does not use make use of this, I think something similar would be useful in the stdlib.
History
Date User Action Args
2012年07月02日 13:34:37sbtsetrecipients: + sbt, jaraco, ncoghlan, pitrou, eric.smith, tim.golden, eric.araujo, r.david.murray, brian.curtin, dabrahams, davide.rizzo, dlenski
2012年07月02日 13:34:37sbtsetmessageid: <1341236077.02.0.845745751602.issue14243@psf.upfronthosting.co.za>
2012年07月02日 13:34:36sbtlinkissue14243 messages
2012年07月02日 13:34:35sbtcreate

AltStyle によって変換されたページ (->オリジナル) /