Author eryksun
Recipients Carl Osterwisch, Gabi.Davar, John Florian, dabrahams, davide.rizzo, dlenski, eric.araujo, eric.smith, eryksun, jaraco, jwilk, martin.panter, ncoghlan, paul.moore, piotr.dobrogost, pitrou, r.david.murray, sbt, steve.dower, tim.golden, zach.ware
Date 2017-02-25.04:49:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487998180.56.0.420405675955.issue14243@psf.upfronthosting.co.za>
In-reply-to
Content
Nick wrote:
> 1. Open the file in the current process
> 2. Write content to the file
> 3*. Close the file in the current process

In step 1, do you mean calling NamedTemporaryFile with delete=False? In that case there's no immediate problem with opening the file again in Windows. If you mean calling NamedTemporaryFile with delete=True, then step 3 deletes the file. 

Adding support for Windows share modes would be useful in general and would help within the current process. However, users may also need to open the temporary file in another process. Most programs don't open their files with shared delete access. 

There's a workaround to allow the file to be opened normally, but it involves setting the delete disposition and then clearing it in a pointless dance. It would be better to implement an option such as delete=AFTER_CM_EXIT, to try to remove the file without relying on O_TEMPORARY. The downside is that the file won't be deleted if the interpreter crashes, gets terminated or if another process has the file open without delete sharing.
History
Date User Action Args
2017-02-25 04:49:40eryksunsetrecipients: + eryksun, paul.moore, jaraco, ncoghlan, pitrou, eric.smith, tim.golden, jwilk, eric.araujo, r.david.murray, dabrahams, davide.rizzo, sbt, Gabi.Davar, martin.panter, piotr.dobrogost, zach.ware, dlenski, steve.dower, Carl Osterwisch, John Florian
2017-02-25 04:49:40eryksunsetmessageid: <1487998180.56.0.420405675955.issue14243@psf.upfronthosting.co.za>
2017-02-25 04:49:40eryksunlinkissue14243 messages
2017-02-25 04:49:39eryksuncreate