-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
ExitStack and AsyncExitStack have close and aclose methods, respectively, that finalize all entries in the stack before scope exit would otherwise do it. Right now, close and aclose accept no parameters and all stack entries are finalized as successes --- i.e. a call to __exit__ with no exception information.
It would be useful to add an optional exception parameter to close and aclose that would allow us to explicitly close a stack as if it had failed, e.g. with a synthetic timeout exception. Today, you can do the job by manually invoking __exit__ or __aexit__ on the stack, but .close() is meant to be more ergonomic.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement