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 jaraco
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-11.22:51:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618181468.46.0.658470761745.issue14243@roundup.psfhosted.org>
In-reply-to
Content
At least I and Ethan and Martin have expressed a desire for the default, preferred usage work well in a portable environment. Requiring `delete_on_close=False` violates that expectation.

How about something like this instead:

- Add an `delete_when=None`, also accepting "close" and "exit".
- "close" means delete on close.
- "exit" means delete when the context manager exits.
- When `delete_when` is None, the default behavior is selected (currently `close`).
- At some point (now or in the future), raise a deprecation warning if `delete_when=None` is passed (require it to be explicit) and explain that the default in the future will be `delete_when="exit"`.
- Document that passing an explicit `None` for `delete_when` is not supported (don't do it).
- In a release after the deprecation has been released, change the default to `delete_when="exit"` and drop support for `None`.


Note, this deprecation approach could be enacted with "delete_on_close" and boolean values, but I prefer more explicit values for shorter-named variables.


This approach would allow a user to opt in to the future behavior which has the desired effect of preferring the default behavior (in as little as two releases).

I might be tempted to create a `backports` package for users of earlier Python versions to get the future behavior sooner.
History
Date User Action Args
2021-04-11 22:51:08jaracosetrecipients: + jaraco, paul.moore, 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-11 22:51:08jaracosetmessageid: <1618181468.46.0.658470761745.issue14243@roundup.psfhosted.org>
2021-04-11 22:51:08jaracolinkissue14243 messages
2021-04-11 22:51:08jaracocreate