implement PEP 479: replace accidental StopIteration exceptions that exit the generator body by RuntimeError