Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
- debugpy version: 2025.10.0
- OS and version: windows 10.0.19045.6218
- Python version Python 3.9.21
- Using VS Code or Visual Studio: vscode 1.103.2
Actual behavior
debug this
class TestInstance:
def __init__(self):
print('__init__')
pass
def __enter__(self):
print('__enter__')
return self
def __exit__(self, excType, exc, tb):
print('__exit__')
pass
def test():
with TestInstance() as ti:
print('yield')
yield ti
for ti in test():
print('raise')
raise Exception
it prints
__init__
__enter__
yield
raise
__exit__
and stops at the raise line (because it's an unhandled exception)
it shouldn't print this __exit__. it should stop on the raise.
Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
Actual behavior
debug this
it prints
and stops at the
raiseline (because it's an unhandled exception)it shouldn't print this
__exit__. it should stop on theraise.