Paul Moore <p.f.mo...@gmail.com> added the comment:

Looking at the various comments, I think we have 5 votes for deleting on CM 
exit when used as a CM, and no change in behaviour otherwise (me, Zachary, 
Ethan, Jason and Steve). Steve also wants O_TEMPORARY to be removed, which 
doesn't seem controversial among this group of people.

Eryk has argued for a delete_on_close flag that would need to be explicitly set 
to False, retaining the use of O_TEMPORARY in the default case, but there 
doesn't seem to be a lot of support for that.

If I've misrepresented anyone's view, please speak up!

I didn't look back at the stuff from 2013 and earlier, I'll admit.

I do think this needs care to implement (and document!) correctly. For example, 
consider the following case:

    ntf = NamedTemporaryFile()
    # Do some stuff (1)
    with ntf:
        # Do some stuff (2)
    # Do some followup stuff

I assume we'd want a close in (1) to delete the file, but a close in (2) to 
leave it open until the CM exit.

Evgeny, would you be willing to update your PR (including adding the docs 
change, and tests to catch as many edge cases as you can think up) to match 
this behaviour?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue14243>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to