[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows
Chary Chary added the comment: Dear all, are there any plans to move this quite old issue forward? I stumbled across this issue, because I found that at the moment there is no out of the box solution to use tempfile.NamedTemporaryFile in Windows in such scenario (which is often used in unit testing): * in test module: 1) create and open temporary file 2) write data to it 3) pass name of the temporary file to the operational code * In operational code, being tested 1) open file, using name of the temporary file 2) read data from this temporary file -- nosy: +chary314 ___ Python tracker <https://bugs.python.org/issue14243> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows
Chary Chary added the comment: Steve Dower, thanks for looking at this. After reading the thread from my amature point of view I kind of liked suggestion of Daniel Lenski to replace the binary delete argument of the current NamedTemporaryFile implementation with finer-grained options https://bugs.python.org/issue14243#msg164369 This would also take care of the comment from Dave Abrahams, that <> https://bugs.python.org/issue14243#msg155457 As for your comment to include FILE_SHARE_DELETE. If the decision is taken to go this path, shall we also not include FILE_SHARE_READ and FILE_SHARE_WRITE? https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea -- ___ Python tracker <https://bugs.python.org/issue14243> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows
Chary Chary added the comment: Why do we need to use this O_TEMPORARY flag at all? I understand that we are using OS functionality, available on Windows, rather than implementing it in Python. But why doing this, if we already do this for none-nt systems in Python any way? Doesn't it just complicate the code? https://github.com/python/cpython/blob/fa8c9e70104b0aef966a518eb3a80a4881906ae0/Lib/tempfile.py#L423 -- ___ Python tracker <https://bugs.python.org/issue14243> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows
Chary Chary added the comment: I am not sure, this is the correct place to ask this "educational" question, but I will do this any way: where is this O_TEMPORARY flag defined? if I looks at [tempfile.py](https://github.com/python/cpython/blob/3ff6975e2c0af0399467f234b2e307cc76efcfa9/Lib/tempfile.py#L539) then appears, that it is defined in the os.py module. But in [os.py](https://github.com/python/cpython/blob/3ff6975e2c0af0399467f234b2e307cc76efcfa9/Lib/os.py) I can't find it -- ___ Python tracker <https://bugs.python.org/issue14243> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com