Resolves the "RuntimeError: generator didn't stop after throw()" issue by replacing the generator-based @contextmanager with an explicit class. This maintains backward compatibility through a factory function.
Resolves the "RuntimeError: generator didn't stop after throw()" issue by replacing the generator-based @contextmanager with an explicit class. This maintains backward compatibility through a factory function.