fork download
  1. import asyncio
  2.  
  3. class Example:
  4. async def __aenter__(self):
  5. return 3
  6. async def __aexit__(self, exc_type, exc, tb):
  7. return True
  8.  
  9. async def example():
  10. async with Example() as three:
  11. print(three == 3)
  12. raise Exception
  13. print("Exception got suppressed")
  14.  
  15. asyncio.run(example())
Success #stdin #stdout 0.12s 16156KB
stdin
Standard input is empty
stdout
True
Exception got suppressed