Repository navigation
Clean up ContextManagers when a manager fails to enter - #954
Open
remote-controlled-man wants to merge 1 commit into
Open
remote-controlled-man wants to merge 1 commit into
remote-controlled-man wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while adding setup-error coverage for fastai/fastai#4186. If an early manager acquires a lock and a later manager raises in
__enter__,ContextManagers.__enter__exits without unwinding itsExitStack. The lock stays acquired while the wrapper or traceback is still reachable, so subsequent work can block.Unwind the already-entered stack with the exception information before propagating the entry failure. Add regression coverage using a real lock and temporary environment state, plus reverse exit order, identical
RuntimeError/KeyboardInterruptobjects, later managers/body not entered, successful entry and empty collections. The notebook documents the failure behavior.Validation on macOS, Python 3.12:
nbdev-test --n-workers 2suite: passed, with no notebook selection or added skips.03_xtras.ipynbtest,nbdev-clean, source export and clean/diff checks: passed.The other OS/Python combinations in the CI matrix were not run locally.
AI assistance: OpenAI Codex assisted implementation, tests and review.