Fix #395: Call __exit__ on exception in with block

This commit is contained in:
kvhankalas star 2025-12-01 18:23:57 +05:30
parent ef9b4779f4
commit 347f49b291

12
src/tests/test.py Normal file
View File

@ -0,0 +1,12 @@
class Test:
def __enter__(self):
print("enter")
return self
def __exit__(self, exc_type, exc, tb):
print("__exit__ called", exc_type)
return False
with Test():
print("inside")
raise Exception("boom!")