restore a generator's caller's exception state both on yield and (last) return

This prevents generator exception state from leaking into the caller.

Closes #12475.
3 files changed