[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-21 Thread Giampaolo Rodola'
Change by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-21 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-20 Thread R. David Murray
Change by R. David Murray : -- resolution: duplicate -> stage: resolved -> needs patch status: closed -> open ___ Python tracker ___

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-20 Thread R. David Murray
R. David Murray added the comment: Nick, what Jakub is saying is that 'with' hasn't even gotten involved yet: we're still executing the NamedTemporaryFile constructor, so the object hasn't been returned for 'with' to operate on yet. In other words, NamedTemporaryFile.__init__ isn't safe

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-20 Thread Nick Coghlan
Nick Coghlan added the comment: It's still the same problem - the underlying issue is that the with statement machinery doesn't currently mask signals in the main thread while __enter__ and __exit__ are running, so __enter__ and __exit__ methods written in Python are also at risk of being

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-20 Thread Jakub Wilk
Jakub Wilk added the comment: I think issue29988 is unrelated, or at least not the whole story. These are samples of tracebacks I see when the file is left behind: Traceback (most recent call last): File "test-tmpfile.py", line 4, in with tempfile.NamedTemporaryFile(dir='.'):

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-20 Thread Nick Coghlan
Nick Coghlan added the comment: Aye, this is a specific case of the general issue noted in https://bugs.python.org/issue29988 (while it may be partially mitigated by https://bugs.python.org/issue32949, it isn't a guarantee) -- resolution: -> duplicate stage: -> resolved status:

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Nick, is this related to the bug where the "finally" portion of a context manager isn't guaranteed to be called? -- nosy: +ncoghlan, rhettinger ___ Python tracker

[issue34157] NamedTemporaryFile can leave temporary files behind

2018-07-19 Thread Jakub Wilk
New submission from Jakub Wilk : If you press Ctrl+C at the wrong moment, NamedTemporaryFile won't delete the temporary file. To reproduce, you can try this script: import tempfile while True: with tempfile.NamedTemporaryFile(dir='.'): pass I get a stray temporary