Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide/show context managers don't handle exceptions well #625

Closed
bitprophet opened this issue Apr 26, 2012 · 0 comments
Closed

hide/show context managers don't handle exceptions well #625

bitprophet opened this issue Apr 26, 2012 · 0 comments

Comments

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Apr 26, 2012

My understanding of how contextlib.contextmanager works was incorrect -- I thought it handled exceptions, but it doesn't . If an exception occurs during the @contextmanager-using function's yield statement (i.e. inside the with statement using it), the code after the yield won't get run.

This is easily fixed by using try/finally on our end.

EDIT: looks like this actually came up and was fixed for settings() already, as it correctly handles this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.