Perhaps a `try...finally` would be nice here so it plays nicely with any outer exception handlers?
```python
try:
    yield
finally:
    if hold:
        ...
```