How a Python with block swallows exceptions: __exit__ return values and return in finally
When __exit__ returns a true value, the with statement suppresses the exception. How that differs from return in finally, and how to write a suppressor that catches only what you mean.
pythoncontext-managerexceptions