This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
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-30.15:12:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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?
Date User Action Args
2021-04-30 15:12:03paul.mooresetrecipients: + 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, eryksun, steve.dower, Carl Osterwisch, ethan smith, John Florian, ev2geny, chary314
2021-04-30 15:12:03paul.mooresetmessageid: <>
2021-04-30 15:12:03paul.moorelinkissue14243 messages
2021-04-30 15:12:03paul.moorecreate