[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-30 Thread Eryk Sun
Eryk Sun added the comment: For anyone interested, this issue is solvable on Windows by working around how O_TEMPORARY is implemented. To do this the _winapi module would need a wrapper for SetFileInformationByHandle (available in Vista+), which would need to support at least FileDispositionIn

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-30 Thread Марк Коренберг
Changes by Марк Коренберг : -- resolution: -> wont fix status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-22 Thread Марк Коренберг
Марк Коренберг added the comment: David Murray, in your code, if temporary file cannot be created, it attempts to unlink unknown name :). But, I already have almost the same solution in production. I mention it sources in issue8604. -- ___ Python t

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread R. David Murray
R. David Murray added the comment: Oh, you are right of course. I thought I was looking at _mkstemp_inner but in fact my edit window was over NamedTemporaryFile...I just wasn't paying attention. I have no opinion myself as to whether it is worth the effort/code complexity to implement this b

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread Eryk Sun
Eryk Sun added the comment: > To extend support for this to Windows, we can add a > feature to mkstmp to not use O_TEMPORARY O_TEMPORARY is only used for NamedTemporaryFile, not mkstemp. Regarding NamedTemporaryFile, that can be worked around to keep Windows from deleting the file. Just open

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread R. David Murray
R. David Murray added the comment: You'd have to do that anyway if we implemented a delete=False constructor argument, since you want it deleted if there are any errors, and that's not what a delete=False API would do. If it were me, I'd write it (untested) @contextlib.contextmanager de

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-21 Thread Марк Коренберг
Марк Коренберг added the comment: So, I'm required to re-implement NamedTemporaryFile by hand like that: fd, name = tempfile.mkstemp(...) try: with io.open(fd, ...) as fff: fff.write('hello') fff.flush() os.fdatasync(fff) os.rename

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-20 Thread R. David Murray
R. David Murray added the comment: I think it is a reasonable backward-compatibility fix to make it work as badly as it previously did ;). I would not document it, and I do not consider it a high priority (as Serhiy said, this usage reached into object internals and thus was dangerous from th

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-12-20 Thread Марк Коренберг
Марк Коренберг added the comment: ping. THis is essential in our software, so we use private field in order to work-around this bug. -- ___ Python tracker ___ __

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-11-27 Thread Марк Коренберг
Марк Коренберг added the comment: No activity last week ? Why not to merge ? -- ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue21579] Python 3.4: tempfile.close attribute does not work

2015-11-16 Thread Марк Коренберг
Марк Коренберг added the comment: Please merge patch, proposed by Eduardo Seabra (Eduardo.Seabra). And document that this is UNIX-only solution. -- versions: +Python 3.5, Python 3.6 Added file: http://bugs.python.org/file41055/test_tempfile.py ___ Py

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-11-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See also issue14243. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-11-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If it is possible to cancel the effect of the O_TEMPORARY flag, we can use it to implement this feature on all platforms. But if it is not possible, we have several options: 1. Just close this issue and do nothing more. This was undocumented and non-portabl

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-06-16 Thread Eduardo Seabra
Eduardo Seabra added the comment: I've attached a patch with @mmarkk proposal. -- keywords: +patch nosy: +Eduardo.Seabra Added file: http://bugs.python.org/file35662/issue21579.patch ___ Python tracker

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, it would be easy to restore this behavior on Posix. -- keywords: +easy stage: -> needs patch ___ Python tracker ___

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Марк Коренберг
Марк Коренберг added the comment: why not to make tmpfileobj.delete as property that really sets self._closer.delete ? this will fix my problem. -- ___ Python tracker ___ __

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Марк Коренберг
Марк Коренберг added the comment: So, maybe API change? like delete=True|False|Maybe ? don't think that this is good decisions. My approach is based on ext4 behaviour about delayed allocation and atomic file replacements. In my case, either old file (with contents) or new file appear. In any c

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: OK, O_TMPFILE is not related. But Windows is related. -- ___ Python tracker ___ ___ Python-bugs-li

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Марк Коренберг
Марк Коренберг added the comment: Yes, but O_TMPFILE should be set ONLY when used with TemporaryFile, not with NamedTemporaryFile. My problem refer only NamedTemporaryFile. -- ___ Python tracker _

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In any case this trick didn't work on Windows. And it can't work on Linux too when use new O_TMPFILE flag (issue21515). -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-26 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +georg.brandl, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-25 Thread Berker Peksag
Berker Peksag added the comment: See issue 18879 for more information about the change. -- nosy: +berker.peksag, pitrou ___ Python tracker ___ ___

[issue21579] Python 3.4: tempfile.close attribute does not work

2014-05-25 Thread Марк Коренберг
New submission from Марк Коренберг: Suppose code: = import os import tempfile want_to_replace = 'zxc.dat' tmpdir=os.path.dirname(os.path.realpath(want_to_replace)) with tempfile.NamedTemporaryFile(dir=tmpdir) as fff: # do somewhat with fff here... and then