The code provided isn't storing any internal state (aside from the resume location) as far as I can see. The generator thus generated isn't reentrant and has other flaws, but those pale to nothing when you consider that nothing on the stack is preserved..