Skip to content

Instantly share code, notes, and snippets.

@RavenKyu
Created November 12, 2018 02:49
Show Gist options
  • Save RavenKyu/9c503308757ff4bfbe6d4d40cb5fdd44 to your computer and use it in GitHub Desktop.
Save RavenKyu/9c503308757ff4bfbe6d4d40cb5fdd44 to your computer and use it in GitHub Desktop.
with error?
class TestClass(object):
def a(self):
raise TypeError
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
print(exc_type, exc_val, exc_tb)
return True
with TestClass() as f:
f.a()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment