ContextManager __exit__ fail on TypeError exception