Message390911
| Author |
eryksun |
| Recipients |
Carl Osterwisch, Gabi.Davar, John Florian, chary314, dabrahams, davide.rizzo, dlenski, eric.araujo, eric.smith, eryksun, ethan smith, ethan.furman, ev2geny, jaraco, jwilk, martin.panter, ncoghlan, njs, paul.moore, piotr.dobrogost, pitrou, r.david.murray, sbt, steve.dower, tim.golden, zach.ware |
| Date |
2021年04月12日.21:52:05 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1618264325.37.0.568205039865.issue14243@roundup.psfhosted.org> |
| In-reply-to |
| Content |
> So we stop passing the O_TEMPORARY flag. If __enter__() is called,
> close() closes the file but doesn't delete anything, and
> __exit__() closes the file (if open) and deletes it (even if it
> wasn't open). If there is no __enter__(), close() also deletes the
> file.
This behavior change is fine if O_TEMPORARY isn't used. I wasn't disagreeing with Ethan. I was providing a summary of a common use case that conflicts with using O_TEMPORARY to make it clear that this flag has to be omitted if we're not implementing something like a delete_on_close boolean option.
Most of my last comment, however, was dedicated to implementing TemporaryFile() if this change is applied, instead of leaving it as an alias for NamedTemporaryFile(). I can't imagine not wanting the guaranteed cleanup semantics of O_TEMPORARY in the case of an anonymous temporary file that doesn't need to be reopened. I also want O_SHORT_LIVED. This opens the file with the attribute FILE_ATTRIBUTE_TEMPORARY [1], which tells the cache manager to try to keep the file contents in memory instead of flushing data to disk.
---
[1] https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#caching_behavior |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2021年04月12日 21:52:05 | eryksun | set | recipients:
+ eryksun, paul.moore, jaraco, ncoghlan, pitrou, eric.smith, tim.golden, jwilk, eric.araujo, r.david.murray, njs, dabrahams, ethan.furman, davide.rizzo, sbt, Gabi.Davar, martin.panter, piotr.dobrogost, zach.ware, dlenski, steve.dower, Carl Osterwisch, ethan smith, John Florian, ev2geny, chary314 |
| 2021年04月12日 21:52:05 | eryksun | set | messageid: <1618264325.37.0.568205039865.issue14243@roundup.psfhosted.org> |
| 2021年04月12日 21:52:05 | eryksun | link | issue14243 messages |
| 2021年04月12日 21:52:05 | eryksun | create |
|